forked from inviqa/ansible-jumpcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
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
6 changed files
with
222 additions
and
57 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
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
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 |
---|---|---|
@@ -1,60 +1,63 @@ | ||
--- | ||
- name: Download JumpCloud Kickstart script | ||
get_url: | ||
url: "{{ jumpcloud_x_connect_url }}" | ||
dest: "{{ jumpcloud_kickstart_script }}" | ||
mode: 0755 | ||
headers: "x-connect-key: {{ jumpcloud_x_connect_key }}" | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: if the system is a Ubuntu 12.xx then tricks the temporary the version for the Kickstarter to work | ||
- name: If the system is a Ubuntu 12.xx then tricks the temporary the version for the Kickstarter to work | ||
lineinfile: | ||
path: /etc/issue | ||
regexp: '^Ubuntu 12' | ||
line: 'Ubuntu 14.04.5 LTS \n \l' | ||
state: present | ||
backup: yes | ||
when: ansible_distribution == "Ubuntu" and "12" in ansible_distribution_version | ||
register: line_infile_result | ||
|
||
- name: saving the position of the `/etc/issue` backup | ||
path: /etc/issue | ||
regexp: '^Ubuntu 12' | ||
line: 'Ubuntu 14.04.5 LTS \n \l' | ||
state: present | ||
backup: yes | ||
when: ansible_distribution == "Ubuntu" and "12" in ansible_distribution_version and (jumpcloud_not_installed or jumpcloud_force_install) | ||
register: line_infile_result | ||
|
||
- name: saving the position of the `/etc/issue` backup | ||
set_fact: | ||
issue_backup_file: "{{ line_infile_result.backup}}" | ||
when: ansible_distribution == "Ubuntu" and "12" in ansible_distribution_version and line_infile_result is defined | ||
when: ansible_distribution == "Ubuntu" and "12" in ansible_distribution_version and line_infile_result is defined and (jumpcloud_not_installed or jumpcloud_force_install) | ||
|
||
- name: Install JumpCloud Agent | ||
shell: "{{ jumpcloud_kickstart_script }}" | ||
- name: Download JumpCloud Kickstart script | ||
get_url: | ||
url: "{{ jumpcloud_x_connect_url }}" | ||
dest: "{{ jumpcloud_kickstart_script }}" | ||
mode: 0755 | ||
headers: "x-connect-key: {{ jumpcloud_x_connect_key }}" | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: Install JumpCloud Agent | ||
shell: "{{ jumpcloud_kickstart_script }}" | ||
args: | ||
creates: "{{ jumpcloud_agent_config}}" | ||
become: "{{ jumpcloud_use_sudo }}" | ||
creates: "{{ jumpcloud_agent_config}}" | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
|
||
- name: restore '/etc/issue' backup if present | ||
- name: check JumpCloud agent config again | ||
stat: | ||
path: "{{ jumpcloud_agent_config }}" | ||
register: jumpcloud_agent_config_status | ||
|
||
- name: check again if JumpCloud has been initialised | ||
set_fact: | ||
jumpcloud_is_installed: "{{ jumpcloud_agent_config_status.stat.isreg is defined and jumpcloud_agent_config_status.stat.isreg}}" | ||
|
||
- name: Reset JumpCloud if `jcagent.conf` has not been created | ||
import_tasks: reset_jumpcloud.yml | ||
when: not jumpcloud_is_installed | ||
|
||
- name: restore '/etc/issue' backup if present | ||
file: | ||
src: "{{issue_backup_file}}" | ||
path: /etc/issue | ||
state: hard | ||
force: yes | ||
when: issue_backup_file is defined | ||
src: "{{issue_backup_file}}" | ||
path: /etc/issue | ||
state: hard | ||
force: yes | ||
when: issue_backup_file is defined | ||
|
||
- name: removes '/etc/issue' backup file if present | ||
- name: removes '/etc/issue' backup file if present | ||
file: | ||
path: "{{issue_backup_file}}" | ||
state: absent | ||
when: issue_backup_file is defined | ||
|
||
|
||
- name: Restart JumpCloud | ||
service: | ||
name: "{{ jumpcloud_agent_service }}" | ||
state: restarted | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: Make Sure that jcagent.conf has been created | ||
wait_for: | ||
path: "{{ jumpcloud_agent_config}}" | ||
state: present | ||
timeout: 60 | ||
msg: Timeout to find file "{{ jumpcloud_agent_config}}" | ||
path: "{{issue_backup_file}}" | ||
state: absent | ||
when: issue_backup_file is defined | ||
|
||
|
||
|
||
|
||
... |
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,37 @@ | ||
--- | ||
- debug: | ||
msg: "Distribution {{ ansible_distribution }}" | ||
|
||
- name: Install dependencies in CentOS systems | ||
yum: | ||
name: "{{ item }}" | ||
state: present | ||
with_items: "{{ jumpcloud_centos_dependencies }}" | ||
when: ansible_distribution == "CentOS" | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: Install dependencies in RHEL systems | ||
yum: | ||
name: "{{ item }}" | ||
state: present | ||
with_items: "{{ jumpcloud_rhel_dependencies }}" | ||
when: ansible_distribution == "Red Hat Enterprise Linux" | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: Install JumpCloud depenedencies for Debian systems | ||
apt: | ||
name: "{{ item }}" | ||
state: present | ||
with_items: "{{ jumpcloud_debian_dependencies }}" | ||
when: ansible_distribution == "Debian" | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: Install JumpCloud depenedencies for Ubuntu systems | ||
apt: | ||
name: "{{ item }}" | ||
state: present | ||
with_items: "{{ jumpcloud_ubuntu_dependencies }}" | ||
when: ansible_distribution == "Ubuntu" | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
... |
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
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,47 @@ | ||
--- | ||
- name: stop JumpCloud | ||
service: | ||
name: "{{ jumpcloud_agent_service }}" | ||
state: stopped | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: remove JumpCloud CA certificate | ||
file: | ||
path: "{{jumpcloud_ca_cert}}" | ||
state: absent | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: remove JumpCloud Client certificate | ||
file: | ||
path: "{{jumpcloud_client_cert}}" | ||
state: absent | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: remove JumpCloud Client Key | ||
file: | ||
path: "{{jumpcloud_client_key}}" | ||
state: absent | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: Start JumpCloud | ||
service: | ||
name: "{{ jumpcloud_agent_service }}" | ||
state: started | ||
become: "{{ jumpcloud_use_sudo }}" | ||
|
||
- name: Make Sure that jcagent.conf has been created | ||
wait_for: | ||
path: "{{ jumpcloud_agent_config}}" | ||
state: present | ||
timeout: 60 | ||
msg: Timeout to find file "{{ jumpcloud_agent_config}}" | ||
|
||
- name: check JumpCloud agent config again | ||
stat: | ||
path: "{{ jumpcloud_agent_config }}" | ||
register: jumpcloud_agent_config_status | ||
|
||
- name: check again if JumpCloud is installed | ||
set_fact: | ||
jumpcloud_is_installed: "{{ jumpcloud_agent_config_status.stat.isreg is defined and jumpcloud_agent_config_status.stat.isreg}}" | ||
... |