<!DOCTYPE html><html><head><title></title><style type="text/css">
p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>## Step 7 of ?: set up certbot<br></div><div><br></div><div><br></div><div>That's the more difficult or tricky bit. In your steps<br></div><div>you are using the interactive move of certbot. Although<br></div><div>Ansible as an 'expect' module<br></div><div>(<a href="https://docs.ansible.com/ansible/latest/collections/ansible/builtin/expect_module.html">https://docs.ansible.com/ansible/latest/collections/ansible/builtin/expect_module.html</a>),<br></div><div>I would strongly recommend to try to find a way to perform that config without<br></div><div>interactions. That makes things so much easier.<br></div><div><br></div><div>As for outputting some stuff from the remote host, you can always<br></div><div>capture the output of commands, and then print them out as an action:<br></div><div><br></div><div>```<br></div><div>- name: get the location of the tool 'waldo'<br></div><div>  shell: whereis waldo<br></div><div>  register: waldo_res<br></div><div><br></div><div>- debug: var=waldo_res.stdout<br></div><div><br></div><div>```<br></div><div><br></div><div>## Step 8 of 8: putting it in a playbook<br></div><div><br></div><div>Finally time to run that sucker. We need a playbook that will<br></div><div>execute the role 'onboard' on all the hosts belonging to<br></div><div>the onboarding group.<br></div><div><br></div><div>```<br></div><div># in ./playbooks/onboard.yml<br></div><div><br></div><div>- name: all aboard!<br></div><div>  hosts: onboarding<br></div><div>  roles: onboard<br></div><div>```<br></div><div><br></div><div><br></div><div>And with that you should be able to do<br></div><div><br></div><div>$ ansible-playbook ./playbooks/onboard.yml<br></div><div><br></div><div>and have the role be applied to all the machines. You could also do a dry run<br></div><div>and see the diffs of files that would be changed.<br></div><div><br></div><div>$ ansible-playbook ./playbooks/onboard.yml --check --diff<br></div><div><br></div><div>Or do a lot of other things, like further limit the playbook to only one<br></div><div>host without changing the playbook itself:<br></div><div><br></div><div>$ ansible-playbook ./playbooks/onboard.yml -l yanick.ottawa.ca<br></div><div><br></div><div><br></div><div>And, in a nutshell, that's it. :-)<br></div><div><br></div><div><br></div><div><br></div><div>Tadah,<br></div><div>`/anick`<br></div><div><br></div></body></html>