-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,9 @@ | |
- role: flow | ||
tags: [flow] | ||
|
||
- role: provision | ||
tags: [provision] | ||
|
||
- role: gui | ||
tags: [gui] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Role: opennebula.deploy.flow | ||
============================ | ||
|
||
A role that sets up the OneProvision utility. | ||
|
||
Requirements | ||
------------ | ||
|
||
N/A | ||
|
||
| Name | Type | Default | Example | Description | | ||
| --------------------------- | ----- | -------------------------------------------------------------------------------- | --------------------------------- | ------------------------------------------ | | ||
| `terraform_source` | `str` | https://releases.hashicorp.com/terraform/0.14.7/terraform_0.14.7_linux_amd64.zip | http://mirror.local/terraform.zip | Where to look the terraform zipped binary | | ||
| `ansible_version_provision` | `str` | 2.15 | `2.18` | `ansible-core` pip package version | | ||
|
||
|
||
|
||
Dependencies | ||
------------ | ||
|
||
- opennebula.deploy.opennebula.common | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
- hosts: frontend | ||
roles: | ||
- role: opennebula.deploy.helper.facts | ||
- role: opennebula.deploy.provision | ||
|
||
License | ||
------- | ||
|
||
Apache-2.0 | ||
|
||
Author Information | ||
------------------ | ||
|
||
[OpenNebula Systems](https://opennebula.io/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
terraform_source: https://releases.hashicorp.com/terraform/0.14.7/terraform_0.14.7_linux_amd64.zip | ||
ansible_version_provision: '2.15.13' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
collections: | ||
- opennebula.deploy | ||
|
||
dependencies: | ||
- role: opennebula.deploy.common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
- name: Install Terraform | ||
ansible.builtin.unarchive: | ||
src: "{{ terraform_source }}" | ||
dest: /usr/local/bin | ||
remote_src: true | ||
mode: '0755' | ||
creates: /usr/local/bin/terraform | ||
|
||
|
||
- tags: [preinstall] | ||
block: | ||
- ansible.builtin.include_role: | ||
name: repository | ||
vars: | ||
repos_enabled: [opennebula] | ||
when: opennebula_repo is undefined | ||
|
||
- name: Install OneProvision | ||
ansible.builtin.package: | ||
name: "{{ _common + _specific[ansible_os_family] }}" | ||
vars: | ||
_common: [opennebula-provision] | ||
_specific: | ||
Debian: [] | ||
RedHat: [] | ||
register: package | ||
until: package is success | ||
retries: 12 | ||
delay: 5 | ||
|
||
- name: Check Ansible version | ||
ansible.builtin.shell: | ||
cmd: | | ||
version=$(ansible --version | head -n1) | ||
if echo "$version" | grep -q "core"; then | ||
echo "$version" | awk '{print $3}' | tr -d '[]' | ||
else | ||
echo "$version" | awk '{print $2}' | ||
fi | ||
register: ansible_version_check | ||
changed_when: false | ||
|
||
- name: Install required Ansible version | ||
when: ansible_version_check.stdout is version(ansible_version_provision, '<') | ||
block: | ||
- name: Ensure python3-pip is installed | ||
ansible.builtin.package: | ||
name: python3-pip | ||
state: present | ||
|
||
- name: Install updated ansible version | ||
ansible.builtin.pip: | ||
name: "ansible-core>={{ ansible_version_provision }}" | ||
state: present | ||
become: true | ||
become_user: oneadmin | ||
ignore_errors: true # pipx error message might show |