-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacdev.yml
49 lines (47 loc) · 1.43 KB
/
macdev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
- name: Download config
hosts: localhost
tasks:
- name: Download config
get_url:
url: "{{ config_url }}"
dest: "{{ playbook_dir }}/host_vars/localhost.yml"
register: config_download
when: config_url is defined
- fail:
when: config_download is changed
- name: Sudo check
hosts: localhost
# set defaults
pre_tasks:
- set_fact:
role_ssh: "{{ role_ssh|default(false) }}"
role_sys: "{{ role_sys|default(false) }}"
role_cfg: "{{ role_cfg|default(false) }}"
role_ansible: "{{ role_ansible|default(false) }}"
role_pip: "{{ role_pip|default(false) }}"
role_brew: "{{ role_brew|default(false) }}"
role_app: "{{ role_app|default(false) }}"
tasks:
- name: Check if sudo works
shell: sudo echo "sudo works"
become: yes
become_user: root
register: sudo_check
changed_when: false
ignore_errors: true
when: role_sys
- debug: msg="Run 'sudo echo' to fix this."
failed_when: true
when: role_sys and sudo_check is failed
- name: Simple macOS setup
hosts: localhost
roles:
- { role: env }
- { role: ssh, when: role_ssh|bool }
- { role: system, when: role_sys|bool }
- { role: config, when: role_cfg|bool }
- { role: ansible, when: role_ansible|bool }
- { role: pip, when: role_pip|bool }
- { role: brew, when: role_brew|bool }
- { role: app, when: role_app|bool }