--- - name: Deploy terraform hosts: localhost gather_facts: false tasks: - name: Deploy terraform community.general.terraform: project_path: ../terraform/ state: present complex_vars: true variables: location: "nbg1" network_zone: "eu-central" server_count: 3 subnetwork_ip_range: "10.0.0.0/24" lb_internal_ip: "10.0.0.100" lb_external_ip: "167.235.105.161" lb_service_id: 1399502 ssh_keys: - "rothe.pub" - "alt.pub" register: tf_out - add_host: name: "{{ item.key }}" ansible_host: "{{ item.value }}" group: web loop: "{{ tf_out.outputs.server_ips.value | dict2items }}" - name: Setup LEMP stack hosts: web vars_files: - vault.yaml vars: server_name: wordpress-jr.senecops.com wordpress: dir: /var/www/html/wordpress db_name: wordpress db_user: wp php: version: 8.1 gluster: brick_dir: /srv/data/wordpress mount_dir: /var/www/html/wordpress vol_name: wordpress_vol dir_owner: wordpress dir_group: www-data cluster: - 10.0.0.3 - 10.0.0.4 - 10.0.0.5 mysql: replication_user: replica_user replication_master: web1 replication_slaves: - web2 - web3 pre_tasks: - debug: var=ansible_all_ipv4_addresses # we need gluster on all servers to configure peering roles: - nginx - mysql - mysql-replication - php - glusterfs - wordpress