forked from melihovv/initial-webserver-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitial-setup.yml
44 lines (36 loc) · 1.06 KB
/
initial-setup.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
---
- hosts: all
gather_facts: False
remote_user: root
vars_files:
- vars/main.yml
roles:
- name: user
remote_user: "{{ test_user | success | ternary(omit, 'root') }}"
tags: user
- name: ssh
remote_user: "{{ user }}"
tags: ssh
pre_tasks:
- name: Check if user specified in config is installed
local_action: "command ssh -q -o BatchMode=yes -o ConnectTimeout=3 {{ inventory_hostname }} 'echo ok'"
register: test_user
ignore_errors: true
changed_when: false
- name: Install python2
remote_user: "{{ test_user | success | ternary(omit, 'root') }}"
raw: sudo apt install -y python-minimal
become: true
- name: Install aptitude
remote_user: "{{ test_user | success | ternary(omit, 'root') }}"
apt:
name: aptitude
state: present
become: true
- name: Update all packages
remote_user: "{{ test_user | success | ternary(omit, 'root') }}"
apt:
update_cache: yes
upgrade: safe
autoremove: yes
become: true