Get configuration file from puppet
This commit is contained in:
parent
94c08a9e61
commit
5c42e7a297
1 changed files with 51 additions and 26 deletions
|
@ -1,28 +1,4 @@
|
||||||
---
|
---
|
||||||
- name: Ensure puppet server master section is configured
|
|
||||||
ini_file:
|
|
||||||
path: /etc/puppetlabs/puppet/puppet.conf
|
|
||||||
section: master
|
|
||||||
option: "{{ item.key }}"
|
|
||||||
value: "{{ item.value }}"
|
|
||||||
mode: '0644'
|
|
||||||
backup: true
|
|
||||||
create: true
|
|
||||||
loop: "{{ puppet_master_config | dict2items }}"
|
|
||||||
notify: 'Restart puppetserver'
|
|
||||||
|
|
||||||
- name: Ensure puppet server server section is configured
|
|
||||||
ini_file:
|
|
||||||
path: /etc/puppetlabs/puppet/puppet.conf
|
|
||||||
section: server
|
|
||||||
option: "{{ item.key }}"
|
|
||||||
value: "{{ item.value }}"
|
|
||||||
mode: '0644'
|
|
||||||
backup: true
|
|
||||||
create: true
|
|
||||||
loop: "{{ puppet_server_config | dict2items }}"
|
|
||||||
notify: 'Restart puppetserver'
|
|
||||||
|
|
||||||
- name: Find puppetserver command
|
- name: Find puppetserver command
|
||||||
shell: which puppetserver | awk '{print($1)}' | true
|
shell: which puppetserver | awk '{print($1)}' | true
|
||||||
register: which_puppetserver
|
register: which_puppetserver
|
||||||
|
@ -59,11 +35,53 @@
|
||||||
msg: "Puppet command couldn't be found"
|
msg: "Puppet command couldn't be found"
|
||||||
when: which_puppet.stdout == ""
|
when: which_puppet.stdout == ""
|
||||||
|
|
||||||
|
- name: Get puppet configuration file
|
||||||
|
shell: "{{ which_puppet.stdout }} config print config"
|
||||||
|
register: puppet_config_file_result
|
||||||
|
|
||||||
|
- name: Set variable for Puppet configuration file
|
||||||
|
set_facts:
|
||||||
|
puppet_config_file: "{{ puppet_config_file_result.stdout }}"
|
||||||
|
|
||||||
|
- name: Ensure puppet server master section is configured
|
||||||
|
ini_file:
|
||||||
|
path: "{{ puppet_config_file }}"
|
||||||
|
section: master
|
||||||
|
option: "{{ item.key }}"
|
||||||
|
value: "{{ item.value }}"
|
||||||
|
mode: '0644'
|
||||||
|
backup: true
|
||||||
|
create: true
|
||||||
|
loop: "{{ puppet_master_config | dict2items }}"
|
||||||
|
notify: 'Restart puppetserver'
|
||||||
|
|
||||||
|
- name: Ensure puppet server server section is configured
|
||||||
|
ini_file:
|
||||||
|
path: "{{ puppet_config_file }}"
|
||||||
|
section: server
|
||||||
|
option: "{{ item.key }}"
|
||||||
|
value: "{{ item.value }}"
|
||||||
|
mode: '0644'
|
||||||
|
backup: true
|
||||||
|
create: true
|
||||||
|
loop: "{{ puppet_server_config | dict2items }}"
|
||||||
|
notify: 'Restart puppetserver'
|
||||||
|
|
||||||
- name: Configure CA server
|
- name: Configure CA server
|
||||||
shell: "{{ which_puppet.stdout }} config set ca_server {{ puppet_server_name }}"
|
ini_file:
|
||||||
|
path: "{{ puppet_config_file }}"
|
||||||
|
section: master
|
||||||
|
option: ca_server
|
||||||
|
value: "{{ puppet_server_name }}"
|
||||||
|
# shell: "{{ which_puppet.stdout }} config set ca_server {{ puppet_server_name }}"
|
||||||
|
|
||||||
- name: Configure autosign server
|
- name: Configure autosign server
|
||||||
shell: "{{ which_puppet.stdout }} config set autosign true"
|
ini_file:
|
||||||
|
path: "{{ puppet_config_file }}"
|
||||||
|
section: master
|
||||||
|
option: autosign
|
||||||
|
value: "true"
|
||||||
|
# shell: "{{ which_puppet.stdout }} config set autosign true"
|
||||||
|
|
||||||
- name: Check if puppet code folder exists
|
- name: Check if puppet code folder exists
|
||||||
stat:
|
stat:
|
||||||
|
@ -139,6 +157,13 @@
|
||||||
dest: /etc/puppetlabs/puppet/prometheus.yaml
|
dest: /etc/puppetlabs/puppet/prometheus.yaml
|
||||||
backup: yes
|
backup: yes
|
||||||
|
|
||||||
|
- name: Configure puppet reports to prometheus
|
||||||
|
ini_file:
|
||||||
|
path: "{{ puppet_config_file }}"
|
||||||
|
section: master
|
||||||
|
option: reports
|
||||||
|
value: prometheus
|
||||||
|
|
||||||
- name: Ensure hiera-eyaml is installed
|
- name: Ensure hiera-eyaml is installed
|
||||||
shell: "{{ which_puppetserver.stdout }} gem install hiera-eyaml"
|
shell: "{{ which_puppetserver.stdout }} gem install hiera-eyaml"
|
||||||
args:
|
args:
|
||||||
|
|
Loading…
Reference in a new issue