0

Im trying to setup SSL with certbot on a multi-site Worpress environment thats managed by Ansible. I looked into the nginx folder and seems like theres a custom nginx config file thats being managed by Puppet. What is the proper way for me to add the server config changes thats needed for SSL setup.

user3312508
  • 907
  • 4
  • 10
  • 25
  • Do you need to make changes to the primary config, or only to a file in sites-enabled? If only a file in sites-enabled, is Puppet managing the whole dir and is Puppet still actively managing it? – MillerGeek Sep 26 '16 at 19:37
  • I ran puppet-ls but looks like its not installed. But somehow the `sites-available` folder has a `50-_.conf` file which has "# File Managed By Puppet" comment at the top of file. – user3312508 Sep 26 '16 at 19:41
  • Without knowing more about the system I would suggest one of two things. If this is your server and no one else's, you could try disabling that site, and as long as Puppet doesn't re-enable it don't worry about it. If it's a shared or managed server and you can't risk messing up other people, or if Puppet steps in and fixes the file, you can just set up your own site in Nginx and work around the Puppet managed one. – MillerGeek Sep 26 '16 at 19:45
  • @smiller171 will that override puppet config settings? say for example the ports it listen to ? Kind of a noob at this. – user3312508 Sep 26 '16 at 20:00
  • 1
    @user3312508, it's all a question of which resources Puppet is managing, and which it is not. You should not make manual modifications to a Puppet-managed file, lest they be lost when Puppet next runs, but you may be able to apply the needed configuration by modifying or adding other files. – John Bollinger Sep 26 '16 at 20:22

1 Answers1

0

There are many options. I will list the two i use

file { '/etc/nginx/sites-available/default':
    content => template('module_name/nginx.conf.erb'),
    owner   => $user,
    group   => $groupname
  } 

OR

file_line{ 'Add line to file':
  path => '/path/to/file/',  
  line => "line to add",
  match   =>'regex for the line you want to replace' 
  }
Atmesh Mishra
  • 527
  • 10
  • 26