mirror of
https://github.com/roles-ansible/ansible_role_i3wm.git
synced 2024-08-16 10:09:53 +02:00
Optimize playbook workflow without defined username
This commit is contained in:
parent
a7092361c7
commit
612f3326b6
5 changed files with 10 additions and 7 deletions
|
@ -43,7 +43,7 @@ Role Variables
|
||||||
i3_applications: []
|
i3_applications: []
|
||||||
|
|
||||||
*ansible user*
|
*ansible user*
|
||||||
i3wm_user: "{{ user }}"
|
i3wm_user: "{{ ansible_user_id }}"
|
||||||
|
|
||||||
Example Playbook
|
Example Playbook
|
||||||
----------------
|
----------------
|
||||||
|
|
|
@ -30,15 +30,16 @@
|
||||||
owner: "{{ i3wm_user }}"
|
owner: "{{ i3wm_user }}"
|
||||||
|
|
||||||
- name: register i3 config file
|
- name: register i3 config file
|
||||||
action: stat path="~/.config/i3/config"
|
action: stat path="/home/{{ i3wm_user }}/.config/i3/config"
|
||||||
register: "config_file"
|
register: "config_file"
|
||||||
|
|
||||||
- name: backup i3 config file
|
- name: backup i3 config file
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- name: backup i3 config file if exists
|
- name: backup i3 config file if exists
|
||||||
copy:
|
copy:
|
||||||
src: ~/.config/i3/config
|
src: "/home/{{ i3wm_user }}/.config/i3/config"
|
||||||
dest: ~/.config/i3/config.bak
|
dest: "/home/{{ i3wm_user }}/.config/i3/config.bakup"
|
||||||
remote_src: true
|
remote_src: true
|
||||||
when: config_file.stat.exists
|
when: config_file.stat.exists
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@
|
||||||
dest: "/home/{{ i3wm_user }}/.config/i3/config"
|
dest: "/home/{{ i3wm_user }}/.config/i3/config"
|
||||||
|
|
||||||
- name: check i3 config file
|
- name: check i3 config file
|
||||||
command: i3 -C
|
command: "i3 -C -c /home/{{ i3wm_user }}/.config/i3/config"
|
||||||
register: check_config_response
|
register: check_config_response
|
||||||
failed_when: check_config_response.stdout.find('ERROR') != -1
|
failed_when: check_config_response.stdout.find('ERROR') != -1
|
||||||
rescue:
|
rescue:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
user: vagrant
|
i3wm_user: vagrant
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
vars:
|
vars:
|
||||||
user: "{{ ansible_user }}"
|
i3wm_user: "{{ ansible_user }}"
|
||||||
roles:
|
roles:
|
||||||
- travis_test
|
- travis_test
|
||||||
|
|
|
@ -30,3 +30,5 @@ __i3_workspaces:
|
||||||
- workspace:
|
- workspace:
|
||||||
id: 0
|
id: 0
|
||||||
name: " 0 "
|
name: " 0 "
|
||||||
|
|
||||||
|
user: "{{ i3wm_user }}"
|
||||||
|
|
Loading…
Reference in a new issue