I'm presently writing some documentation (specifically on how to set up Ansible with a local Vagrant machine) and I like to list commentary in the form of commands to issue. For example:
Set up the SSH agent:
ssh-agent bash ssh-add .vagrant/machines/default/virtualbox/private_key
However, sometimes I find I want to document a change in a config file, which is not so easy to describe. I presently do this:
Configure Ansible to use port 2222 for Vagrant
Modify /etc/ansible/ansible.cfg to use remote_port = 2222
I'd rather do something like this (a theoretical command) as it could be issued quickly and in a more automated fashion than reaching for a text editor:
Configure Ansible to use port 2222 for Vagrant
ansible-config remote_port 2222
This appears to be an ini file, so if the ansible
binary doesn't support this (and I can't see that it does), is there a general Linux/Unix way to do this? Failing the above, how about:
iniwrite /etc/ansible/ansible.cfg defaults.remote_port 2222
Of course I could write a script of some kind, but it'd be better not to reinvent the wheel!
I am using Ubuntu 14.04 LTS.