ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Setting up an Ansible Test Environment in Ubuntu 16.04.4

    IT Discussion
    ansible ubuntu 16.04 how to
    4
    8
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wirestyle22W
      wirestyle22
      last edited by wirestyle22

      #update and install LXC
      sudo -i
      apt-get update && apt-get install lxc

      #create new containers
      lxc-create -n db1 Ubuntu -d
      lxc-create -n web Ubuntu -d
      lxc-create -n web2 Ubuntu -d
      Note: When you create your first container, in this case db1, you'll notice it takes awhile to pull everything you need. After it does that you'll experience a huge speed increase as it's referencing those files in /var/cache/lxc/trusty/*.

      #list your containers
      lxc-ls -f

      0_1523387954445_Capture.PNG

      #start the containers
      lxc-start -n db1 -d <-- always daemonize when first creating and initializing a container.
      lxc-start -n web -d
      lxc-start -n web2 -d

      #list your containers
      lxc-ls -f

      0_1523388258230_Capture.PNG
      Note: LXC sets up a virtual network device called LXCBR, or "LXC Bridge" and a DHCP server that hands out IP Addresses specifically for your LXC containers.

      #Attach to a container to run commands directly within that container
      lxc-attach -n db1
      0_1523388586374_Capture.PNG

      #install ssh inside of the container. After installation, connect to the container via ssh.
      sudo apt-get install openssh-server

      #install python2 inside the container as a target machine requirement for Ansible playbooks
      apt-get install python-minimal --no-install -recommends

      Repeat the process for each remaining container.
      lxc-attach -n web
      apt-get install python-minimal --no-install -recommends

      lxc-attach -n web2
      apt-get install python-minimal --no-install -recommends

      1 Reply Last reply Reply Quote 0
      • wirestyle22W
        wirestyle22
        last edited by wirestyle22

        Helpful commands for initial setup:

        lxc-start -- starts the container
        lxc-info -- confirms the status of the container
        lxc-ls -- lists containers
        lxc-attach -- run commands from a specified container
        lxc-stop -- stops the container
        lxc-destroy -- destroys container

        1 Reply Last reply Reply Quote 0
        • coliverC
          coliver
          last edited by

          Any reason for doing this on Ubuntu? Especially such a dated version?

          wirestyle22W 1 Reply Last reply Reply Quote 0
          • wirestyle22W
            wirestyle22 @coliver
            last edited by

            @coliver The course I'm taking does it in this version of Ubuntu. No other reason than that.

            1 Reply Last reply Reply Quote 0
            • wirestyle22W
              wirestyle22
              last edited by

              I thought this version was only a month old?

              https://wiki.ubuntu.com/Releases

              scottalanmillerS 1 Reply Last reply Reply Quote 0
              • scottalanmillerS
                scottalanmiller @wirestyle22
                last edited by

                @wirestyle22 said in Setting up an Ansible Test Environment in Ubuntu 16.04.4:

                I thought this version was only a month old?

                https://wiki.ubuntu.com/Releases

                The PATCH is a month old, the VERSION is two years old.

                wirestyle22W 1 Reply Last reply Reply Quote 1
                • wirestyle22W
                  wirestyle22 @scottalanmiller
                  last edited by wirestyle22

                  @scottalanmiller said in Setting up an Ansible Test Environment in Ubuntu 16.04.4:

                  @wirestyle22 said in Setting up an Ansible Test Environment in Ubuntu 16.04.4:

                  I thought this version was only a month old?

                  https://wiki.ubuntu.com/Releases

                  The PATCH is a month old, the VERSION is two years old.

                  Gotcha. Still what I'm using in the course

                  1 Reply Last reply Reply Quote 0
                  • DanpD
                    Danp
                    last edited by

                    For anyone interested, I recently setup Ansible AWX on Fedora 27 using this guide. Running as a local VM so didn't do anything with Nginx / reverse proxy.

                    1 Reply Last reply Reply Quote 3
                    • 1 / 1
                    • First post
                      Last post