Deploy Standalone TripleO using tripleo-operator-ansible

By amolkahat, Wed 27 May 2020, in category Tripleo

ansible, openstack, tripleo

Tripleo-operator-ansible contains playbooks that can be used to automate TripleO OpenStack deployments. It is just an wrapper around the openstack tripleo cli.

Why Tripleo-operator-ansible?

What is tripleo-operator-ansible?

What is tripleo-operator-ansible not.

Deploy TripleO Standalone using tripleo-operator-ansible

useradd stack
echo "redhat" | passwd --stdin stack
echo "stack ALL=(ALL) NOPASSWD:ALL" | tee -a /etc/sudoers.d/stack
su - stack
$ wget https://trunk.rdoproject.org/centos8-master/current-tripleo/delorean.repo -O /etc/yum.repos.d/delorean.repo
$ wget https://trunk.rdoproject.org/centos8-master/delorean-deps.repo -O /etc/yum.repos.d/delorean-deps.repo
$ sudo dnf install tripleo-operator-ansible ansible -y
---
###############################################################################
# Standalone installation playbook
#
# Description:
#   This is a basic playbook to run a simple standalone node deployment on an
#   existing provisioned system.
#
###############################################################################
- hosts: localhost
  collections:
    - tripleo.operator
  vars:
    standalone_debug: true
    standalone_dns:
      - 1.1.1.1
      - 192.168.122.1
    standalone_hostname: 'standalone.localdomain'
    standalone_ip: 192.168.24.1
    standalone_cidr: 24
    standalone_gateway:
    standalone_local_mtu: 1400
    standalone_local_interface: enp2s0
    standalone_enable_selinux: false
    standalone_virt_type: qemu
    install_debug: true

  tasks:
    - name: Set hostname
      hostname:
        name: "{{ standalone_hostname }}"
      become: true

    - name: Configure tripleo repositories
      include_role:
        name: tripleo_repos
      vars:
        tripleo_repos_debug: "{{ install_debug }}"

    - name: Ensure system is up to date
      yum:
        name: '*'
        state: latest  # noqa 403
      register: packages_updated
      become: true

    # If you are running playbook inside the vm then it will fail on reboot task.
    # If you are running outside the vm then make sure to uncomment it.
    #
    #- name: Reboot if necessary
    #  reboot:
    #  become: true
    #  when: packages_updated is changed

    - name: install python3 tripleoclient
      package:
        name: python3-tripleoclient
        state: present
      become: true

    - name: Generate parameters.yaml
      copy:
        content: |
          parameter_defaults:
            CloudName: {{ standalone_hostname }}
            {% if standalone_gateway | default(False) -%}
            ControlPlaneStaticRoutes:
              - ip_netmask: 0.0.0.0/0
                next_hop: {{ standalone_gateway }}
                default: true
            {% endif -%}
            Debug: {{ standalone_debug|bool }}
            DeploymentUser: {{ ansible_env.USER }}
            DnsServers: {{ standalone_dns }}
            KernelIpNonLocalBind: 1
            NeutronPublicInterface: {{ standalone_local_interface }}
            NeutronBridgeMappings: datacenter:br-ctlplane
            NeutronPyshicalBridge: br-ctlplane
            StandaloneEnableRoutedNetworks: false
            StandaloneHomeDir: {{ ansible_env.HOME }}
            InterfacesLocalMtu: {{ standalone_local_mtu }}
            NovaComputeLibvirtType: {{ standalone_virt_type }}
            CertmongerCA: local
            ContainerCli: podman
            NtpServer: clock.redhat.com
            SELinuxMode: permissive
            DockerInsecureRegistryAddress:
              - 192.168.24.1:8787
            MasqueradeNetworks:
              192.168.24.0/24:
              - 192.168.24.0/24
            StandaloneCtlplaneSubnets:
              ctlplane-subnet:
                DhcpRangeEnd: 192.168.24.40
                DhcpRangeStart: 192.168.24.20
                NetworkCidr: 192.168.24.0/24
                NetworkGateway: 192.168.24.1
        dest: "{{ ansible_env.HOME }}/parameters.yaml"

    - name: Generate ContainerImagePrepare
      include_role:
        name: tripleo_container_image_prepare_default
      vars:
        tripleo_container_image_prepare_default_output_env_file: "{{ ansible_env.HOME }}/container-image-prepare.yaml"

    - name: Run standalone deployment
      include_role:
        name: tripleo_deploy
      vars:
        tripleo_deploy_debug: "{{ standalone_debug }}"
        tripleo_deploy_templates: /usr/share/openstack-tripleo-heat-templates
        tripleo_deploy_local_ip: "{{ standalone_ip }}/{{ standalone_cidr }}"
        tripleo_deploy_roles_file: /usr/share/openstack-tripleo-heat-templates/roles/Standalone.yaml
        tripleo_deploy_environment_files:
          - /usr/share/openstack-tripleo-heat-templates/environments/standalone/standalone-tripleo.yaml
          - "{{ ansible_env.HOME }}/container-image-prepare.yaml"
          - "{{ ansible_env.HOME }}/parameters.yaml"
        tripleo_deploy_standalone: true
        tripleo_deploy_output_dir: "{{ ansible_env.HOME }}"
standalone_local_interface: enp2s0
$ ansible-playbook standalone.yaml
export OS_CLOUD=standalone
openstack catalog list

Congratulations!! you just successfully installed the TripleO standalone deployment. :)

Thank you Chandan Kumar for configuration related changes.

If you find any issue, ping us on #tripleo channel on freenode server.