diff --git a/README.md b/README.md index 8b46c31..4ea49fc 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,13 @@ note: all playbooks tested with Ubuntu 18.04 minimum AMI image - sets root password for su task (Ubuntu 18.04) - requires [nginx_install_controller_vars.yaml](nginx_install_controller_vars.yaml) +`ansible-playbook nginx_controller_embedded_install.yaml -i controller -e "su_password=''"` +- installs nginx Controller with embedded DB +- sets root password for su task of selected FQDN/IP machine +- requires a inventory file with name 'controller' in same location +- requires NGINX controller ansible galaxy installed (You can install by looking at collection folder requirements yaml file) +- requires nginx_controller_embedded_install_vars.yaml + `nginx_installer_controller_vars.yaml` | your Controller settings `nginx_install_controller.yaml` | installs nginx controller and pre-requisites diff --git a/nginx_controller_embedded_install.yaml b/nginx_controller_embedded_install.yaml new file mode 100644 index 0000000..10f869c --- /dev/null +++ b/nginx_controller_embedded_install.yaml @@ -0,0 +1,87 @@ +--- +# ansible-playbook nginx_install_controller.yaml -i controller -e "su_password='K33p0ut'" +## retreive dynamic settings information at the Ansible Controller + +## on the remote host +- name: load vars and prereqs + hosts: controllers + remote_user: ubuntu + become: yes + become_method: sudo + gather_facts: yes + + tasks: + - name: load the vars + include_vars: + file: "{{playbook_dir}}/nginx_controller_embedded_install_vars.yaml" + + - name: make sure all the prerequisites are present + apt: + name: "{{ packages }}" + state: present + update_cache: yes + vars: + packages: + - gettext + - bash + - gzip + - coreutils + - grep + - less + - sed + - tar + - jq + - socat + - conntrack + - ebtables + - python-pexpect # to support ansible + tags: packages + + # Supporting su requirement for Controller installer role + - name: set root password to support su for Controller installation with Ubuntu + user: + name: root + password: "{{ su_password | password_hash('sha512') }}" + + +## changing security context on the remote host to su +- name: install controller + remote_user: ubuntu + hosts: controllers + become: yes + become_user: ubuntu + become_method: su + gather_facts: false + collections: + - nginxinc.nginx_controller + + pre_tasks: + - name: load the vars + include_vars: + file: "{{playbook_dir}}/nginx_controller_embedded_install_vars.yaml" + + - name: set the controller public fqdn variable + set_fact: + nginx_controller_fqdn: "{{nginx_controller_fqdn}}" + + tasks: + - name: Print some db debug information + debug: msg="Hello your DB details are - {{nginx_controller_bundled_db}}, {{nginx_controller_db_host}}, {{nginx_controller_configdb_volume_type}}" + + - name: initiate controller install role + import_role: + name: nginx_controller_install + + +# pull the install log +- hosts: controller + remote_user: ubuntu + become: yes + become_method: sudo + gather_facts: false + + tasks: + - name: fetch the install log + fetch: + src: /var/log/nginx-controller/nginx-controller-install.log + dest: "{{playbook_dir}}/logs/" diff --git a/nginx_controller_embedded_install_vars.yaml b/nginx_controller_embedded_install_vars.yaml new file mode 100644 index 0000000..61b42c0 --- /dev/null +++ b/nginx_controller_embedded_install_vars.yaml @@ -0,0 +1,26 @@ +--- +su_password: 'admin@123!' +nginx_controller_tarball: "/home/ubuntu/{{controller_tarball}}" +nginx_controller_install_path: /home/ubuntu +nginx_controller_remote_source: "true" +nginx_controller_tsdb_volume_type: "local" +nginx_controller_smtp_host: "localhost" +nginx_controller_smtp_port: "25" +nginx_controller_smtp_authentication: "false" +nginx_controller_smtp_use_tls: false +nginx_controller_noreply_address: "abc@txt.com" +nginx_controller_fqdn: "" +nginx_controller_organization_name: "test" +nginx_controller_admin_firstname: "test" +nginx_controller_admin_lastname: "admin" +nginx_controller_admin_email: "abc@txt.com" +nginx_controller_user_email: "abc@txt.com" +nginx_controller_user_password: 'Testenv12#' +nginx_controller_admin_password: 'Testenv12#' +nginx_controller_self_signed_cert: true +nginx_controller_overwrite_existing_configs: true +nginx_controller_auto_install_docker: false +nginx_controller_bundled_db: true +controller_tarball: "controller-installer.tar.gz" + +ansible_python_interpreter: /usr/bin/python3