2018-08-27 14:05:45 +00:00
|
|
|
---
|
2019-04-26 15:48:28 +00:00
|
|
|
- hosts: localhost
|
|
|
|
become: false
|
|
|
|
tasks:
|
2019-11-01 08:57:20 +00:00
|
|
|
- name: Playbook dir stat
|
|
|
|
stat:
|
|
|
|
path: "{{ playbook_dir }}"
|
|
|
|
register: _playbook_dir
|
|
|
|
|
|
|
|
- name: Ensure Ansible is not being run in a world writable directory
|
|
|
|
assert:
|
2021-10-31 09:58:35 +00:00
|
|
|
that: _playbook_dir.stat.mode|int <= 775
|
2019-11-01 08:57:20 +00:00
|
|
|
msg: >
|
|
|
|
Ansible is being run in a world writable directory ({{ playbook_dir }}), ignoring it as an ansible.cfg source.
|
|
|
|
For more information see https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
|
|
|
|
|
2019-05-17 12:49:29 +00:00
|
|
|
- name: Ensure the requirements installed
|
|
|
|
debug:
|
|
|
|
msg: "{{ '' | ipaddr }}"
|
|
|
|
ignore_errors: true
|
|
|
|
no_log: true
|
|
|
|
register: ipaddr
|
|
|
|
|
2019-07-31 14:24:08 +00:00
|
|
|
- name: Set required ansible version as a fact
|
|
|
|
set_fact:
|
|
|
|
required_ansible_version:
|
2021-10-31 09:58:35 +00:00
|
|
|
"{{ item | regex_replace('^ansible-core[\\s+]?(?P<op>[=,>,<]+)[\\s+]?(?P<ver>\\d.\\d+(.\\d+)?)$',
|
2019-07-31 14:24:08 +00:00
|
|
|
'{\"op\": \"\\g<op>\",\"ver\": \"\\g<ver>\" }') }}"
|
2021-10-31 09:58:35 +00:00
|
|
|
when: '"ansible-core" in item'
|
2019-07-31 14:24:08 +00:00
|
|
|
with_items: "{{ lookup('file', 'requirements.txt').splitlines() }}"
|
|
|
|
|
2019-09-28 00:10:20 +00:00
|
|
|
- name: Verify Python meets Algo VPN requirements
|
|
|
|
assert:
|
|
|
|
that: (ansible_python.version.major|string + '.' + ansible_python.version.minor|string)|float is version('3.6', '>=')
|
|
|
|
msg: >
|
|
|
|
Python version is not supported.
|
|
|
|
You must upgrade to at least Python 3.6 to use this version of Algo.
|
|
|
|
See for more details - https://trailofbits.github.io/algo/troubleshooting.html#python-version-is-not-supported
|
|
|
|
|
|
|
|
- name: Verify Ansible meets Algo VPN requirements
|
2019-04-26 15:48:28 +00:00
|
|
|
assert:
|
2019-05-17 12:49:29 +00:00
|
|
|
that:
|
2019-07-31 14:24:08 +00:00
|
|
|
- ansible_version.full is version(required_ansible_version.ver, required_ansible_version.op)
|
2019-05-17 12:49:29 +00:00
|
|
|
- not ipaddr.failed
|
2019-04-26 15:48:28 +00:00
|
|
|
msg: >
|
2019-07-31 14:24:08 +00:00
|
|
|
Ansible version is {{ ansible_version.full }}.
|
2019-04-26 15:48:28 +00:00
|
|
|
You must update the requirements to use this version of Algo.
|
2019-09-28 00:10:20 +00:00
|
|
|
Try to run python3 -m pip install -U -r requirements.txt
|
2019-04-26 15:48:28 +00:00
|
|
|
|
2018-08-27 14:05:45 +00:00
|
|
|
- name: Include prompts playbook
|
|
|
|
import_playbook: input.yml
|
|
|
|
|
|
|
|
- name: Include cloud provisioning playbook
|
|
|
|
import_playbook: cloud.yml
|
|
|
|
|
|
|
|
- name: Include server configuration playbook
|
|
|
|
import_playbook: server.yml
|