@@ -51,13 +51,6 @@ back to other tools.
5151 * Ansible transfers reports to Foreman via callback
5252 * Ansible uses Foreman as dynamic inventory
5353
54- ~~~SECTION:notes~~~
55-
56- Role import is broken in the Smart proxy but works still in the Foreman integration
57- Playing roles is broken in Foreman integration but works using Smart proxy
58-
59- ~~~ENDSECTION~~~
60-
6154~~~SECTION:handouts~~~
6255
6356****
@@ -143,14 +136,14 @@ The playbook only requires an array of hosts and roles.
143136### Configure callback plugin
144137
145138 # vi /etc/ansible/ansible.cfg
139+ [defaults]
146140 callback_whitelist = foreman
147- bin_ansible_callbacks = True
148- # vi .bash_profile
149- export FOREMAN_URL="https://foreman.localdomain"
150- export FOREMAN_SSL_CERT="/etc/puppetlabs/puppet/certs/foreman.localdomain.pem"
151- export FOREMAN_SSL_KEY="/etc/puppetlabs/puppet/private_keys/foreman.localdomain.pem"
152- export FOREMAN_SSL_VERIFY="false"
153- # . .bash_profile
141+ ...
142+ [callback_foreman]
143+ url = 'https://foreman.example.com'
144+ ssl_cert = /etc/puppetlabs/puppet/ssl/certs/foreman.localdomain.pem
145+ ssl_key = /etc/puppetlabs/puppet/ssl/private_keys/foreman.localdomain.pem
146+ verify_certs = /etc/puppetlabs/puppet/ssl/certs/ca.pem
154147
155148### Add your host to the inventory
156149
@@ -166,7 +159,7 @@ The playbook only requires an array of hosts and roles.
166159
167160### Download the role "reallyenglish.ntpd"
168161
169- # ansible-galaxy install reallyenglish.ntpd
162+ # ansible-galaxy install reallyenglish.ntpd -p /etc/ansible/roles
170163
171164### Create a playbook and run it
172165
@@ -228,8 +221,8 @@ You can run the script directly to the output and use it with the parameter `-i`
228221
229222### Download Dynamic Inventory and sample configuration
230223
231- # wget -p /etc/ansible/ http://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/foreman.ini
232- # wget -p /etc/ansible/ http://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/foreman.py
224+ # wget -P /etc/ansible/ http://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/foreman.ini
225+ # wget -P /etc/ansible/ http://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/foreman.py
233226 # chmod +x /etc/ansible/foreman.py
234227
235228### Adjust configuration
@@ -255,16 +248,14 @@ You can run the script directly to the output and use it with the parameter `-i`
255248* Steps:
256249 * Install Foreman Plugin and Smart Proxy Plugin
257250 * Import roles and assign them
258- * Configure settings in Foreman
259251 * Prepare Smart proxy to play roles
260252 * Play roles using the webinterface
261253
262254~~~SECTION:handouts~~~
263255
264256****
265257
266- Graphical integration has some bugs and requires improvements which are worked on.
267- Also integration with the callback plugin is not easy as it utilizes environment variables for configuration.
258+ Graphical integration uses Remote-Execution plugin which will be covered later in more depth.
268259
269260~~~ENDSECTION~~~
270261
@@ -283,19 +274,9 @@ Also integration with the callback plugin is not easy as it utilizes environment
283274
284275* Install Foreman Plugin and Smart Proxy Plugin using foreman-installer
285276* Import roles and assign them
286-
287- This requires to adjust the Ansible configuration to include only a single roles_path.
288-
289- * Configure settings in Foreman
290-
291- You can configure the account used, the password and how to get superuser privileges.
292- You can override configuration with host parameters.
293- In production do not use root, but keep it now.
294-
295277* Prepare Smart proxy to play roles
296278
297- Smart Proxy needs a SSH configuration to disable host key checking and an Ansible directory
298- to play roles.
279+ Smart Proxy needs a SSH key to play roles.
299280
300281* Play roles using the webinterface
301282
@@ -315,25 +296,17 @@ to play roles.
315296
316297* Import roles and assign them
317298
318- Adjust the Ansible configuration to include only a single roles_path.
319-
320- # vi /etc/ansible/ansible.cfg
321- roles_path = /etc/ansible/roles
322-
323- Navigate to "Configure > Roles" and import using "Import from Foreman host".
299+ Navigate to "Configure > Roles" and import using "Import from foreman.localdomaon".
324300Afterwards navigate to the host and edit them to assign the roles in the new "Ansible Roles" tab.
325301
326- * Configure settings in Foreman
327-
328- Navigate to "Administer > Settings", on the "Ansible" tab set the password.
329-
330302* Prepare Smart proxy to play roles
331303
332- # install -o foreman-proxy -g foreman-proxy -m 0755 -d ~foreman-proxy/.ansible
333- # install -o foreman-proxy -g foreman-proxy -m 0755 -d ~foreman-proxy/.ssh
334- # sudo -u foreman-proxy vi ~foreman-proxy/.ssh/config
335- Host *
336- StrictHostKeyChecking on
304+ # install -o foreman-proxy -g foreman-proxy -m 0700 -d ~foreman-proxy/.ssh
305+ # su - foreman-proxy -s /bin/bash
306+ # ssh-keygen -f .ssh/id_rsa_foreman_proxy
307+ [ENTER]
308+ [ENTER]
309+ # ssh-copy-id -i .ssh/id_rsa_foreman_proxy root@foreman.localdomain
337310
338311* Play roles using the webinterface
339312
0 commit comments