a34fdb5646f37083a6e5a2053c99909fa9e91971
[ci-management.git] / packer / provision / local-builder.yaml
1 ---
2 - import_playbook: ../common-packer/provision/baseline.yaml
3
4 - hosts: all
5   become_user: root
6   become_method: sudo
7
8   tasks:
9     - apt_repository:
10         repo: ppa:deadsnakes/ppa
11         state: present
12       become: true
13       when: ansible_distribution == 'Ubuntu'
14
15     - name: Update and upgrade apt packages
16       apt:
17         upgrade: 'yes'
18         update_cache: yes
19       become: true
20       when: ansible_distribution == 'Ubuntu'
21
22     - name: Install Python 3.6 and packages
23       apt:
24         name:
25           - python3.6
26           - python3.6-dev
27           - python3.6-tk
28           - libssl-dev
29           - libmysqlclient-dev
30           - gcc
31           - python3-venv
32       become: true
33       when: ansible_distribution == 'Ubuntu'
34
35     - name: Install Python 3.7
36       apt:
37         name:
38           - python3.7
39           - python3.7-dev
40           - python3.7-tk
41       become: true
42       when: ansible_distribution == 'Ubuntu'
43
44     - name: Install Python 3.8
45       apt:
46         name:
47           - python3.8
48           - python3.8-dev
49           - python3.8-tk
50       become: true
51       when: ansible_distribution == 'Ubuntu'
52
53     - name: Install Python 3.9
54       apt:
55         name:
56           - python3.9
57           - python3.9-dev
58           - python3.9-tk
59           - python3.9-distutils
60       become: true
61       when: ansible_distribution == 'Ubuntu'
62
63     - name: Install libssl1.0-dev dep
64       apt:
65         name: libssl1.0-dev
66         update_cache: yes
67         state: fixed
68       become: true
69       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
70
71     - name: Install supporting packages (Ubuntu 18.04)
72       apt:
73         name:
74           - unzip
75           - xz-utils
76           - libxml-xpath-perl
77           - wget
78           - make
79           - sshuttle
80           - netcat
81           - libssl-dev
82           - libffi-dev
83           - xmlstarlet
84           - xvfb
85           - crudini
86           - maven
87           - python-ncclient
88         update_cache: yes
89         state: fixed
90       become: true
91       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
92
93     - name: Install supporting packages (Ubuntu 20.04)
94       apt:
95         name:
96           - unzip
97           - xz-utils
98           - libxml-xpath-perl
99           - wget
100           - make
101           - sshuttle
102           - netcat
103           - libssl-dev
104           - libffi-dev
105           - xmlstarlet
106           - xvfb
107           - crudini
108           - maven
109           - python3-ncclient
110         update_cache: yes
111         state: fixed
112       become: true
113       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
114
115     - name: Install nodejs and npm
116       block:
117         - name: 'Pull latest nodejs version'
118           shell: |
119             curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - && sudo apt-get install -y nodejs
120           become: yes
121         - name: 'Check nodejs version'
122           command: node --version
123         - name: 'Check npm version'
124           command: npm --version
125       when: ansible_distribution == 'Ubuntu'
126
127     - name: Install npm build tools
128       apt:
129         name: build-essential
130         update_cache: yes
131         state: fixed
132       become: true
133       when: ansible_distribution == 'Ubuntu'
134
135     - name: Install enchant2 package for Ubuntu 20.04
136       apt:
137         name:
138           - enchant-2
139         update_cache: yes
140         state: present
141       become: true
142       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04'
143
144     - name: Install enchant package for Ubuntu 18.04
145       apt:
146         name:
147           - enchant
148         update_cache: yes
149         state: present
150       become: true
151       when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '18.04'
152
153     - name: Install enchant2 package for CentOS
154       dnf:
155         name:
156           - enchant2
157         update_cache: yes
158         state: present
159       become: true
160       when: ansible_distribution == 'CentOS'