-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaybook.yml
78 lines (66 loc) · 1.9 KB
/
playbook.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
# Workaround to gather facts in certain scenarios when filtering based on tags.
# https://github.com/ansible/ansible/issues/57529#issuecomment-513143430
- hosts: all
# We need to know the user even when 'become'ing later on.
# Some roles depend on 'ansible_user' for this but that may not
# be present. See https://github.com/ansible/ansible/issues/23530
# So, we set some facts ourselves.
- hosts: all
tasks:
- name: Run whoami to determine username
command: whoami
register: username
- set_fact:
username: "{{ username.stdout }}"
ansible_user: "{{ ansible_user_id }}"
- hosts: all
become: true
tasks:
- import_tasks: tasks/packages.yml
- hosts: all
become: true
vars_files:
- vars/swap.yml
roles:
- { role: geerlingguy.swap }
- hosts: all
vars_files:
- vars/yakht.yml
tasks:
- import_tasks: tasks/fishshell.yml
when: install_shell == "fish"
- hosts: all
become: true
name: Install NodeJS, PHP, and composer
vars_files:
- vars/nodejs.yml
- vars/php.yml
- vars/yakht.yml
pre_tasks:
- name: Add repository for packages
ansible.builtin.apt_repository:
repo: ppa:ondrej/php
roles:
- { role: geerlingguy.php, tags: ["php"] }
- { role: geerlingguy.composer, tags: ["composer"] }
- { role: geerlingguy.nodejs, tags: ["nodejs"] }
- hosts: all
name: Set user configurations
vars_files:
- vars/nodejs.yml
- vars/yakht.yml
tasks:
- name: Add npm-global bin directory to path (fish-shell)
ansible.builtin.copy:
dest: "/home/{{ ansible_user }}/.config/fish/conf.d/npm-global.fish"
content: |
set PATH {{ npm_config_prefix }}/bin $PATH
when: install_shell == "fish"
- name: Set npm config prefix
command: "npm config set prefix {{ npm_config_prefix }}"
- hosts: all
vars_files:
- vars/lando.yml
tasks:
- import_tasks: tasks/lando.yml