Bootstrap Python onto the system
This commit is contained in:
parent
8eaf39fbd7
commit
d7876c6a65
@ -16,6 +16,7 @@
|
||||
shell:
|
||||
cmd: "if [[ $(pacman -Q linux | cut -d \" \" -f 2) > $(uname -r) ]]; then echo reboot; fi"
|
||||
register: reboot_check
|
||||
changed_when: reboot_check.stdout == "reboot"
|
||||
|
||||
- name: Reboot for kernel update
|
||||
reboot:
|
||||
|
1
run.yml
1
run.yml
@ -7,6 +7,7 @@
|
||||
pre_tasks:
|
||||
- import_tasks: tasks/set_host.yml
|
||||
- import_tasks: tasks/ssh_port.yml
|
||||
- import_tasks: tasks/bootstrap.yml
|
||||
|
||||
roles:
|
||||
- role: system
|
||||
|
9
tasks/bootstrap.yml
Normal file
9
tasks/bootstrap.yml
Normal file
@ -0,0 +1,9 @@
|
||||
- name: Check if Python is present
|
||||
ping:
|
||||
ignore_errors: true
|
||||
register: ping
|
||||
|
||||
- name: Bootstrap Python
|
||||
become: no
|
||||
raw: "echo root | su -c 'pacman-key --init && pacman-key --populate archlinuxarm && pacman --noconfirm -Syu python' root"
|
||||
when: ping is failed
|
@ -2,6 +2,7 @@
|
||||
local_action: "command ping -c 1 {{ local_ip }}"
|
||||
become: no
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
register: up_static
|
||||
|
||||
- name: Switch ansible_host to fallback IP
|
||||
|
@ -1,42 +1,42 @@
|
||||
- name: Set default user for SSH
|
||||
- name: Use default credentials for ssh
|
||||
set_fact:
|
||||
ansible_user: "{{ admin_username }}"
|
||||
|
||||
- name: Attempt ssh connection
|
||||
become: no
|
||||
wait_for_connection:
|
||||
timeout: 10
|
||||
ignore_errors: true
|
||||
raw: "echo Pong!"
|
||||
ignore_unreachable: true
|
||||
changed_when: false
|
||||
register: ssh_result_default
|
||||
|
||||
- name: Set ssh to fallback port
|
||||
- name: Use fallback port for ssh
|
||||
set_fact:
|
||||
ansible_ssh_port: 22
|
||||
when:
|
||||
- ssh_result_default is failed
|
||||
- ssh_result_default is unreachable
|
||||
|
||||
- name: Attempt ssh connection
|
||||
become: no
|
||||
wait_for_connection:
|
||||
timeout: 10
|
||||
ignore_errors: true
|
||||
raw: "echo Pong!"
|
||||
ignore_unreachable: true
|
||||
changed_when: false
|
||||
register: ssh_result_port
|
||||
when:
|
||||
- ssh_result_default is failed
|
||||
- ssh_result_default is unreachable
|
||||
|
||||
- name: Set ssh to fallback port and default Arch Linux ARM credentials
|
||||
- name: Use fallback port and default Arch Linux ARM credentials for ssh
|
||||
set_fact:
|
||||
ansible_ssh_port: "22"
|
||||
ansible_user: "alarm"
|
||||
ansible_ssh_password: "alarm"
|
||||
when:
|
||||
- ssh_result_default is failed
|
||||
- ssh_result_port is failed
|
||||
- ssh_result_default is unreachable
|
||||
- ssh_result_port is unreachable
|
||||
|
||||
- name: Attempt ssh connection
|
||||
become: no
|
||||
wait_for_connection:
|
||||
timeout: 10
|
||||
changed_when: false
|
||||
raw: "echo Pong!"
|
||||
when:
|
||||
- ssh_result_default is failed
|
||||
- ssh_result_port is failed
|
||||
- ssh_result_default is unreachable
|
||||
- ssh_result_port is unreachable
|
||||
|
Reference in New Issue
Block a user