|
@@ -20,33 +20,41 @@ virtual environment is probably the easiest choice.
|
|
|
|
|
|
1. Create and activate a virtual environment:
|
|
|
|
|
|
- $ python3 -mvenv ./molecule
|
|
|
- $ bash
|
|
|
- $ source ../molecule/bin/activate
|
|
|
- (molecule) $
|
|
|
+```
|
|
|
+$ python3 -mvenv ./molecule
|
|
|
+$ bash
|
|
|
+$ source ../molecule/bin/activate
|
|
|
+(molecule) $
|
|
|
+```
|
|
|
|
|
|
2. Install `ansible-core`, `molecule` and its plugins, and the linting tools:
|
|
|
|
|
|
- (molecule) $ pip3 install --upgrade pip molecule-plugins[podman,containers] yamllint ansible-lint
|
|
|
- ...
|
|
|
- Successfully installed ... ansible-core-2.18.2 ... molecule-25.2.0 molecule-plugins-23.7.0 ...
|
|
|
+```
|
|
|
+(molecule) $ pip3 install --upgrade pip molecule-plugins[podman,containers] yamllint ansible-lint
|
|
|
+...
|
|
|
+Successfully installed ... ansible-core-2.18.2 ... molecule-25.2.0 molecule-plugins-23.7.0 ...
|
|
|
+```
|
|
|
|
|
|
3. _optional_ If working on Mac or Windows, ensure your Podman VM is started
|
|
|
|
|
|
- (molecule) $ podman machine start
|
|
|
- Starting machine "podman-machine-default"
|
|
|
- ...
|
|
|
- Machine "podman-machine-default" started successfully
|
|
|
+```
|
|
|
+(molecule) $ podman machine start
|
|
|
+Starting machine "podman-machine-default"
|
|
|
+...
|
|
|
+Machine "podman-machine-default" started successfully
|
|
|
+```
|
|
|
|
|
|
## Where are the playbook and role examples?
|
|
|
|
|
|
You simply need to clone this repository after you installed molecule:
|
|
|
|
|
|
- (molecule) $ git clone https://github.com/rhtuser/ansible-examples.git
|
|
|
- Cloning into 'ansible-examples'...
|
|
|
- ...
|
|
|
- Receiving objects: 100% (117/117), 30.50 KiB | 2.54 MiB/s, done.
|
|
|
- Resolving deltas: 100% (27/27), done.
|
|
|
+```
|
|
|
+(molecule) $ git clone https://github.com/rhtuser/ansible-examples.git
|
|
|
+Cloning into 'ansible-examples'...
|
|
|
+...
|
|
|
+Receiving objects: 100% (117/117), 30.50 KiB | 2.54 MiB/s, done.
|
|
|
+Resolving deltas: 100% (27/27), done.
|
|
|
+```
|
|
|
|
|
|
Alternatively, if you want to work on your own copy and push changes to the
|
|
|
repository, log into GitHub with your own account, open the `ansible-examples`
|
|
@@ -55,25 +63,29 @@ your own account.
|
|
|
|
|
|
Enter the working copy and switch to a branch you want to work on.
|
|
|
|
|
|
- (molecule) $ cd ansible-examples
|
|
|
- (molecule) $ git branch -l --remote
|
|
|
- origin/HEAD -> origin/main
|
|
|
- origin/main
|
|
|
- origin/misc
|
|
|
- origin/nonstandard-playbook
|
|
|
- origin/parallelism
|
|
|
- origin/standard-playbook
|
|
|
- origin/standard-role
|
|
|
- (molecule) $ git checkout misc
|
|
|
- branch 'misc' set up to track 'origin/misc'.
|
|
|
- Switched to a new branch 'misc'
|
|
|
+```
|
|
|
+(molecule) $ cd ansible-examples
|
|
|
+(molecule) $ git branch -l --remote
|
|
|
+ origin/HEAD -> origin/main
|
|
|
+ origin/main
|
|
|
+ origin/misc
|
|
|
+ origin/nonstandard-playbook
|
|
|
+ origin/parallelism
|
|
|
+ origin/standard-playbook
|
|
|
+ origin/standard-role
|
|
|
+(molecule) $ git checkout misc
|
|
|
+branch 'misc' set up to track 'origin/misc'.
|
|
|
+Switched to a new branch 'misc'
|
|
|
+```
|
|
|
|
|
|
## How to remove the environment?
|
|
|
|
|
|
Simply exit any shell that is using the virtual environment and remove the directory.
|
|
|
|
|
|
- (molecule) $ exit
|
|
|
- $ rm -rf ./molecule
|
|
|
+```
|
|
|
+(molecule) $ exit
|
|
|
+$ rm -rf ./molecule
|
|
|
+```
|
|
|
|
|
|
Done!
|
|
|
|