Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Waldur Ansible plugin is installed along with Waldur MasterMind. It allows to upload and execute Ansible playbooks, which use Ansible Waldur module.
    Similarly to Ansible Tower, it’s designed to be the hub for all of your automation tasks.
  2. Ansible Waldur module contains collection of Ansible modules to allow provisioning and management of infrastructure under Waldur through Ansible playbooks.
    Similarly to Ansible OpenStack modules, it could be used as part of your playbook or via Ansible CLI.
  3. Ansible module for HomePort enables you to use user-friendly user interface instead of CLI.

Quick start guide

In order to use Ansible-based applications, you should perform following steps:

  1. Install ansible, waldur-ansible and ansible-waldur-module packages from RPM.
  2. Generate SSH key-pair used by Waldur for resource provisioning using ssh-keygen utility.
  3. Upload private part of SSH key to /etc/waldur/id_rsa
  4. Upload public part of SSH key to Waldur MasterMind database either via admin site or REST API.
  5. Specify API_URL, PRIVATE_KEY_PATH, PUBLIC_KEY_UUID in WALDUR_ANSIBLE.
  6. Compose Ansible playbook and archive it to ZIP file.
  7. Upload ZIP archive to Waldur via admin site.
  8. Check that everything works by provisioning application via HomePort.

Waldur Ansible plugin is available in Waldur RPM repository. In order to install it you should issue following command:

...

Code Block
linenumberstrue
- hosts: localhost
  connection: local
  tasks:
    - name: Create a CentOS server
      register: database_server
      waldur_os_add_instance:
        api_url: "{{ api_url }}"
        access_token: "{{ access_token }}"
        ssh_key: "{{ public_key_uuid }}"
        project: "{{ project_uuid }}"
        provider: "{{ provider_uuid }}"
        security_groups: ['default', 'ping', 'ssh', 'web']
        name: Waldur
        image: CentOS
        flavor: m1.little
        subnet: "{{ subnet_uuid }}"
        floating_ip: auto
        system_volume_size: 30
        data_volume_size: 1
        wait: true

    - name: Get facts about the server (including its public v4 IP address)
      set_fact: public_v4="{{ database_server.instance.external_ips.0 }}"

    - name: Add the server to our Ansible inventory
      add_host:
        hostname: "{{ public_v4 }}"
        groups: sql
        ansible_ssh_user: centos
        ansible_ssh_private_key_file: "{{ private_key_path }}"

    - name: Wait for SSH ping
      wait_for:
        host: "{{ public_v4 }}"
        port: 22
        delay: 10

    - name: Get key data
      uri:
        url: "{{ api_url }}keys/{{ user_key_uuid }}/"
        headers:
          Authorization: "Token {{ access_token }}"
      register: key_response

    - name: Get public key
      set_fact: public_key="{{ key_response.json.public_key }}"


- hosts: sql
  become: True

  tasks:

    - name: Update authorized keys
      authorized_key:
        user: centos
        state: present
        key: "{{ hostvars.localhost.public_key }}"

    - name: Enable PostgreSQL 9.5 repository
      yum: name=https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm state=present

    - name: Install PostgreSQL server
      yum: name={{ item }}
      with_items:
        - postgresql95-server
        - python-psycopg2

    - name: Set up PostgreSQL server
      command: /usr/pgsql-9.5/bin/postgresql95-setup initdb
        creates=/var/lib/pgsql/9.5/data/pg_hba.conf

    - name: Enable and start PostgreSQL server
      service: name=postgresql-9.5 state=started enabled=yes

    - name: Create databases
      postgresql_db: name={{ database_name }} encoding=utf8
      become: yes
      become_user: postgres

    - name: Create database users
      postgresql_user: name={{ database_user }}
      become: yes
      become_user: postgres

Quick start guide

As a resume, in order to use Ansible-based applications, you should perform following steps:

...