How to properly log one off changes in Ansible? -
i've started using ansible
server configuration. store ansible-related files in git
repository , works perfectly.
my question is: approaches logging one-off tasks run ansible. example, when deleting old users accounts, run single task deletes accounts, or include user=john state=absent line
in site.yml
.
is there best-practice this? if include in site.yml
keep increasing. if run one-off task, other members of team not aware task has been run.
in vars/users.yml have list of users want available , list of users no longer required. have versioned source code of state of users.
the following untested
--- users: active: - jon - sansa - arya legacy: - ned - joffrey
then plays ...
- name: add active users user: name: "{{ item }}" state: present with_items: "{{users['active']}}" - name remove legacy users user: name: "{{ item }}" state: absent with_items: "{{users['legacy']}}"
once know joffrey
long gone (do you?) can remove him legacy list you're not ensuring isn't there seasons after left organisation.
he'll still there in version control can refer when added , removed.
Comments
Post a Comment