|
|
@ -3,6 +3,20 @@
|
|
|
|
- name: Configure your machine
|
|
|
|
- name: Configure your machine
|
|
|
|
hosts: all
|
|
|
|
hosts: all
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pre_tasks:
|
|
|
|
|
|
|
|
- name: Write a start message to the playbook log
|
|
|
|
|
|
|
|
ansible.builtin.shell: >
|
|
|
|
|
|
|
|
printf "\nStarted playbook '{{ ansible_play_name }}' execution at {{ now() }}\n"
|
|
|
|
|
|
|
|
>> ./log/{{ inventory_hostname }}.log
|
|
|
|
|
|
|
|
run_once: true
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
args:
|
|
|
|
|
|
|
|
chdir: "{{ playbook_dir }}"
|
|
|
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
become_user: "{{ local_user }}"
|
|
|
|
|
|
|
|
changed_when: true
|
|
|
|
|
|
|
|
tags: always
|
|
|
|
|
|
|
|
|
|
|
|
roles:
|
|
|
|
roles:
|
|
|
|
- { role: common, become: true, tags: [ common ] }
|
|
|
|
- { role: common, become: true, tags: [ common ] }
|
|
|
|
- { role: common-systools, become: true, tags: [ common ] }
|
|
|
|
- { role: common-systools, become: true, tags: [ common ] }
|
|
|
@ -27,15 +41,27 @@
|
|
|
|
# - { role: qbittorrent, become: true, tags: [ qbittorrent ] }
|
|
|
|
# - { role: qbittorrent, become: true, tags: [ qbittorrent ] }
|
|
|
|
|
|
|
|
|
|
|
|
post_tasks:
|
|
|
|
post_tasks:
|
|
|
|
# record the state (commit tag) of this playbook at time of last run
|
|
|
|
- name: Log the current commit of '{{ ansible_play_name }}' playbook
|
|
|
|
- name: Record the current commit tag of this playbook to log
|
|
|
|
|
|
|
|
local_action: >
|
|
|
|
local_action: >
|
|
|
|
shell git log --pretty="Playbook was last committed by %cn on %cd (%H)" -1
|
|
|
|
shell git log
|
|
|
|
>> ./ansible.log
|
|
|
|
--pretty="Playbook '{{ playbook_dir | basename }}' last commit %h %ci by %cn" -1
|
|
|
|
|
|
|
|
>> ./log/{{ inventory_hostname }}.log
|
|
|
|
|
|
|
|
args:
|
|
|
|
|
|
|
|
chdir: "{{ playbook_dir }}"
|
|
|
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
become_user: "{{ local_user }}"
|
|
|
|
|
|
|
|
tags: always
|
|
|
|
|
|
|
|
- name: Write an end message to the playbook log
|
|
|
|
|
|
|
|
ansible.builtin.shell: >
|
|
|
|
|
|
|
|
echo "Ended playbook '{{ ansible_play_name }}' execution at {{ now() }}"
|
|
|
|
|
|
|
|
>> ./log/{{ inventory_hostname }}.log
|
|
|
|
|
|
|
|
run_once: true
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
args:
|
|
|
|
args:
|
|
|
|
chdir: "{{ playbook_dir }}"
|
|
|
|
chdir: "{{ playbook_dir }}"
|
|
|
|
become: true
|
|
|
|
become: true
|
|
|
|
become_user: "{{ local_user }}"
|
|
|
|
become_user: "{{ local_user }}"
|
|
|
|
|
|
|
|
changed_when: true
|
|
|
|
tags: always
|
|
|
|
tags: always
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|