doc/researchAnsible: documented the work to setup and start a Jenkins

The topic Jcasc was already handled. With this commit we are able to
setup a Jenkins by using docker-compose.

Signed-off-by: Marc Mattmüller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmüller 2023-06-21 12:51:40 +02:00
parent 2962890ed3
commit 091f8f8e0d
1 changed files with 121 additions and 0 deletions

View File

@ -911,6 +911,127 @@ After Lauching the job, I checked the docker images directly on the server:
Oh yes, this works too - **Party!**
Job to Start a Jenkins Instance
*******************************
See the following matching table about what we have done so far and what is needed:
============================================= =========================================== =======
What we already have What to we need Ready
============================================= =========================================== =======
Configured a VM / host a host x
SSH key pair for access to services ssh key for git access x
Clone a git repository the repository cloned x
Build the Jenkins docker image the jenkins controller docker image x
Jcasc from the CoreOS proof of concept the docker compose files
data for known_hosts and authorization authorization and known_host files
nexus user and password passwords encrypted for ssh, users, nexus
============================================= =========================================== =======
From this table we see that we are nearly ready. So these are the tasks to be performed until we have all necessary
things to deploy the new Jenkins with a playbook:
#. Prepare the nwl-ci repository by adding the Jenkins Controller parts according this tree:
.. code-block:: bash
.
├── docker-compose.yaml
└── docker
└── nwl-cicd.yaml
#. Create a playbook performing tasks within the cloned nwl-ci repository. Tasks like:
#) adding new directories on the target host:
.. code-block:: bash
.
├── jenkins_home
├── secrets
│ ├── pw
│ ├── .cacerts
│ └── .ssh
└── yocto-downloads
#) creating the following content on the target host:
.. code-block:: bash
.
├── docker-compose.yaml
├── docker
│ ├── nwl-cicd.yaml
│ ├── Dockerfile
│ └── plugins.txt
├── jenkins_home
├── jobs
│ ├── Jenkinsfile_Build
│ ├── Jenkinsfile_Common
│ └── nwlTargets
├── secrets
│ ├── pw
│ │ ├── gitSsh --> testvm_ed25519
│ │ ├── jenkinsUserAdmin
│ │ ├── jenkinsUserDeveloper
│ │ └── nexusUser
│ ├── .cacerts
│ └── .ssh
│ ├── authorized_keys
│ ├── known_hosts
│ ├── testvm_ed25519
│ └── testvm_ed25519.pub
└── yocto-downloads
.. note::
As a reminder you can create the pw using the AWX vault as follows:
``echo -n 'vmSSHpassphrase!' | ansible-vault encrypt_string --ask-vault-pass``
#. Create a playbook bringing the Jenkins instance up
#. **NOTE:** Before doing the next step you have to commit and push your changes and then launch the job
*Clone CI Repo* to update the repository on the server
#. Create a new Job Templates in AWX for the newly created playbooks:
* Select the menu *Resources* >> *Templates* and click *Add*:
- Enter a name, e.g. *Setup CI Environment*
- Enter a description, e.g. *Setting up a Jenkins CI environment using docker-compose*
- Select ``Run`` as Job Type
- Select ``Testenv`` as Organization
- Select ``Production`` as Inventory
- Select ``NWL CI`` as Project
- Select ``playbooks/getting_started/setup-nwl-jenkins.yaml`` as Playbook
- Select the following:
+ Switch the drop-down of *Selected Category* to Machine and then check ``Machine Access``
+ Switch the drop-down of *Selected Category* to Vault and then check ``Vault Password | nwl-vault``
- Press Save
* Select the menu *Resources* >> *Templates* and click *Add*:
- Enter a name, e.g. *Start-Stop CI Instance*
- Enter a description, e.g. *Start or Stop the Jenkins CI instance*
- Select ``Run`` as Job Type
- Select ``Testenv`` as Organization
- Select ``Production`` as Inventory
- Select ``NWL CI`` as Project
- Select ``playbooks/getting_started/start-stop-nwl-jenkins.yml`` as Playbook
- Select the following:
+ Switch the drop-down of *Selected Category* to Machine and then check ``Machine Access``
- Enter ``power_status: "start"`` in Variables and check *Prompt on launch*
+ Change the variable at launch time to ``power_status: "stop"`` to bring the instance down
- Press Save
#. Launch the Jjob *Setup CI Environment*
#. Bring the instance up by launching the job *Start-Stop CI Instance* (keep the variable as it is)
Combining Playbooks
###################