[Charlotte-pm] Is there an Ansible solution to this deployment process?
Yanick Champoux
yanick at babyl.ca
Thu Aug 26 09:32:19 PDT 2021
## Step 7 of ?: set up certbot
That's the more difficult or tricky bit. In your steps
you are using the interactive move of certbot. Although
Ansible as an 'expect' module
(https://docs.ansible.com/ansible/latest/collections/ansible/builtin/expect_module.html),
I would strongly recommend to try to find a way to perform that config without
interactions. That makes things so much easier.
As for outputting some stuff from the remote host, you can always
capture the output of commands, and then print them out as an action:
```
- name: get the location of the tool 'waldo'
shell: whereis waldo
register: waldo_res
- debug: var=waldo_res.stdout
```
## Step 8 of 8: putting it in a playbook
Finally time to run that sucker. We need a playbook that will
execute the role 'onboard' on all the hosts belonging to
the onboarding group.
```
# in ./playbooks/onboard.yml
- name: all aboard!
hosts: onboarding
roles: onboard
```
And with that you should be able to do
$ ansible-playbook ./playbooks/onboard.yml
and have the role be applied to all the machines. You could also do a dry run
and see the diffs of files that would be changed.
$ ansible-playbook ./playbooks/onboard.yml --check --diff
Or do a lot of other things, like further limit the playbook to only one
host without changing the playbook itself:
$ ansible-playbook ./playbooks/onboard.yml -l yanick.ottawa.ca
And, in a nutshell, that's it. :-)
Tadah,
`/anick`
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/charlotte-pm/attachments/20210826/2f2ec661/attachment.html>
More information about the Charlotte-pm
mailing list