Changeset - 5eeaa6ef80fd
[Not reviewed]
0 3 0
Branko Majic (branko) - 3 months ago 2024-02-17 13:38:27
branko@majic.rs
MAR-194: Configure static IPv6 addresses for testing of common role:

- Requires some additional steps to be done when preparing the
development machine, since VirtualBox prohibits use of network
subnets that are not explicitly configured for use with private
networks.
3 files changed with 47 insertions and 4 deletions:
0 comments (0 inline, 0 general)
docs/development.rst
Show inline comments
 
@@ -33,27 +33,43 @@ performing the following steps:
 
2. In order to be able to run role tests, it is necessary to install `VirtualBox
 
   <https://www.virtualbox.org/>`_ and `Vagrant <https://www.vagrantup.com/>`_,
 
   using instructions outlined on their respective websites. It is recommended
 
   to use latest versions available. At time of this writing the role tests have
 
   been successfully run on *VirtualBox 5.2.12* and *Vagrant 2.0.4*.
 

	
 
3. Clone the git repository::
 
3. In order to allow static IPv6 addresses to be allocated to virtual
 
   machines during testing, it is necessary to explicitly white-list
 
   the range used by the tests. Once the configuration file has been
 
   created, however, even the VirtualBox default allowed IPv4 subnet
 
   needs to be in the configuration explicitly as well.
 

	
 
   Update the VirtulBox configuration file (and make sure it can be
 
   read by the user running the tests):
 

	
 
   :file:`/etc/vbox/networks.conf`
 

	
 
   ::
 

	
 
     * 192.168.56.0/21
 
     * fd00::192:168:56:0/116
 

	
 
4. Clone the git repository::
 

	
 
     git clone https://code.majic.rs/majic-ansible-roles/ ~/projects/
 

	
 
4. Create a separate Python virtual environment::
 
5. Create a separate Python virtual environment::
 

	
 
     mkvirtualenv majic-ansible-roles -a ~/projects/majic-ansible-roles/
 

	
 
5. Make sure the virtual environment has been activated, and install `pip-tools
 
6. Make sure the virtual environment has been activated, and install `pip-tools
 
   <https://github.com/jazzband/pip-tools>`_::
 

	
 
     workon majic-ansible-roles
 
     pip install pip-tools
 

	
 
6. Synchronise Python virtual environment with requirements file using
 
7. Synchronise Python virtual environment with requirements file using
 
   **pip-tools**::
 

	
 
     workon majic-ansible-roles
 
     pip-sync
 

	
 

	
roles/common/molecule/default/molecule.yml
Show inline comments
 
@@ -21,12 +21,17 @@ platforms:
 
      - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']"
 
    interfaces:
 
      - auto_config: true
 
        ip: 192.168.56.2
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:2
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
  - name: client1
 
    groups:
 
      - client
 
      - client-allowed
 
    box: debian/bullseye64
 
@@ -36,12 +41,17 @@ platforms:
 
      - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']"
 
    interfaces:
 
      - auto_config: true
 
        ip: 192.168.56.3
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:3
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
  - name: client2
 
    groups:
 
      - client
 
      - client-disallowed
 
    box: debian/bullseye64
 
@@ -51,12 +61,17 @@ platforms:
 
      - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']"
 
    interfaces:
 
      - auto_config: true
 
        ip: 192.168.56.4
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:4
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
  - name: parameters-mandatory-bullseye
 
    groups:
 
      - parameters-mandatory
 
    box: debian/bullseye64
 
    memory: 256
 
@@ -65,12 +80,17 @@ platforms:
 
      - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']"
 
    interfaces:
 
      - auto_config: true
 
        ip: 192.168.56.31
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:31
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
  - name: parameters-optional-bullseye
 
    groups:
 
      - parameters-optional
 
    box: debian/bullseye64
 
    memory: 256
 
@@ -79,12 +99,17 @@ platforms:
 
      - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']"
 
    interfaces:
 
      - auto_config: true
 
        ip: 192.168.56.32
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:32
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
provisioner:
 
  name: ansible
 
  playbooks:
 
    cleanup: cleanup.yml
 
  config_options:
roles/common/molecule/default/prepare.yml
Show inline comments
 
@@ -69,12 +69,14 @@
 
        group: root
 
        mode: 0644
 
        state: present
 
      with_dict:
 
        192.168.56.31: parameters-mandatory-bullseye
 
        192.168.56.32: parameters-optional-bullseye
 
        fd00::192:168:56:31: parameters-mandatory-bullseye
 
        fd00::192:168:56:32: parameters-optional-bullseye
 

	
 
- hosts: parameters-mandatory,parameters-optional
 
  become: true
 
  tasks:
 

	
 
    - name: Set-up /etc/hosts with entries for all servers
0 comments (0 inline, 0 general)