#cloud-config - fw
password: osm
chpasswd: { expire: False }
ssh_pwauth: True 

users:
  - name: ubuntu
    ssh-authorized-keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/ytsRnYehDFUX5nNhICnmR0IxtdFJjn9YAvO3CCx2FzLwOIRtMzUmHPbI3WQ+REyVZtUtdV9pHynO+E5gSolsWZrw9hJ4qT6+T078gayAIpp/i4tJtpOdJwUoOxf8w2AyIcbtH9DJwkv1y8Cx0hFh2TlBKmNnCsE0fGGYHlkusn1odYl1j9t3l037KW7KEpDMslSSYw0Hgbt02hU8sPDZdKpepOaHww+7sEln7ENf614KVdMNw/myvUjY4e3FF3FDqtnO5TUHbFkhCE3rPIm0K1YaAHFXVMibXkcsdvrsBUAiUr79aUAiaFumoutDi2ccaE5v9HPncU3xf5bu+zGP abubakrm@dyn-227-202.lancs.ac.uk

runcmd: 
  -  'sudo ifconfig ens4 192.168.10.15 netmask 255.255.255.0'
  -  'sudo ifconfig ens5 192.168.20.25 netmask 255.255.255.0'
  -  'mkdir /home/ubuntu/bin'

  -  'sudo sysctl -w net.ipv4.ip_forward=1'

write_files:

-   content: |
        #!/bin/bash

        sudo apt-get update
        sudo apt-get upgrade
        sudo apt-get clean
        sudo apt-get autoclean
        sudo apt-get autoremove

    owner: root:root
    permissions: '755'
    path: /home/ubuntu/bin/update-ubuntu

-   content: |
        #!/bin/bash

        echo " "
        echo "The firewall pinging its 1st interface on the 1st datacentre: "
        ping -c 3 192.168.10.15
        echo " "
        echo "The firewall pinging its 2nd interface on the 1st datacentre: "
        ping -c 3 192.168.20.25
        echo " "
        echo "The firewall pinging the client on the 1st datacentre: "
        ping -c 3 192.168.10.5
        echo " "
        echo "The firewall pinging the load-balancer on the 1st datacentre: "
        ping -c 3 192.168.20.35

    owner: root:root
    permissions: '755'
    path: /home/ubuntu/bin/ping_testing_wim_connectivity_between_datacentres
