Skip to content

Commit

Permalink
Merge pull request #20 from ownport/v0.5.0
Browse files Browse the repository at this point in the history
V0.5.0
  • Loading branch information
ownport committed Feb 4, 2021
2 parents 6f23723 + 8cb9b7c commit 7a2c8be
Show file tree
Hide file tree
Showing 31 changed files with 678 additions and 339 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# service directories
bin/
opt/
ansible/
tmp/
.local-ci/
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.5.0

- removed py2.x support
- new approach for building project
- ansible-base, 2.10.5. The list of all packages described in [the requirements file](conf/requirements)

## 0.4.2

- updated python versions
Expand Down
99 changes: 0 additions & 99 deletions Makefile

This file was deleted.

95 changes: 26 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
# Self-contained Ansible distribution

Ansible package with required python modules. No need to install, just download, unpack and use. The main idea of this package is to run Ansible playbooks on local machine

## Included in the distribution

Version: 0.4.2

| Package | Version |
| -------- | ------- |
| ansible | 2.9.10 |
| jinja2 | 2.11.2 |
| PyYAML | 5.3.1 |
| paramiko | 2.7.1 |
| six | 1.15.0 |
| pyasn1 | 0.4.8 |
| asn1crypto | 1.3.0 |
| bcrypt | 3.1.7 |
| cffi | 1.14.0 |
| PyNaCl | 1.4.0 |
| markupsafe | 1.1.1 |
Ansible package with required python modules. No need to install, just download, unpack and use. The main idea of this package is to run Ansible playbooks on local machine.

The distribution contains only `ansible-base`. The extra dependencies will need to be installed manually.

## Changelog

All notable changes to this project are documented in the file CHANGELOG.md

## How to install and use

You just need to download latest version of portable-ansible tarball (.tar.bz2) from
Releases page https://github.com/ownport/portable-ansible/releases and unpack the files
Latest version of portable-ansible tarball (.tar.bz2) is available on
Releases page https://github.com/ownport/portable-ansible/releases

```sh
$ wget https://github.com/ownport/portable-ansible/releases/download/v0.4.2/portable-ansible-v0.4.2-py2.tar.bz2 -O ansible.tar.bz2
$ tar -xjf ansible.tar.bz2
$ python ansible localhost -m ping
wget https://github.com/ownport/portable-ansible/releases/download/<version>/portable-ansible-<version>-py3.tar.bz2 \
-O ansible.tar.bz2

tar -xjf ansible.tar.bz2

python3 ansible localhost -m ping
[WARNING]: provided hosts list is empty, only localhost is available

localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
```
If you need to run ansible playbooks, after having extracted the tarball contents:

### Hints

If you need to run ansible playbooks, after having extracted the tarball contents run next commands to create aliases to portable ansible directory. In the examples below `portable-ansible` installed in `/opt` directory
```sh
$ ln -s ansible ansible-playbook
$ python ansible-playbook playbook.yml
python3 ansible-playbook playbook.yml
```

In the same fashion, to have all the ansible commands, run:
```
To have all the ansible commands, run:
```sh
for l in config console doc galaxy inventory playbook pull vault;do
ln -s ansible ansible-$l
done
Expand All @@ -54,58 +46,23 @@ done

Install python packages into `ansible/extras` directory
```
pip install -t ansible/extras <package>
pip3 install -t ansible/extras <package>
```
or
```
pip install -t ansible/extras -r requirements.txt
pip3 install -t ansible/extras -r requirements.txt
```

Instead of installing the python packages to `ansible/extras`, you can also install them in user directory to be available for ansible:
```
pip install --user -r requirements.txt
```

## Hints

make aliases to portable ansible directory. In the examples below `portable-ansible` installed in `/opt` directory
```
ln -s /opt/ansible /opt/ansible-playbook
```

## Testing

```sh
python3 /opt/ansible-playbook -i 172.17.0.2, ~/playbooks/remote-via-ssh-key.yaml
```

```sh
python3 /opt/ansible-playbook -i 172.17.0.2, -c paramiko ~/playbooks/remote-via-username-and-password.yaml --ask-pass
pip3 install --user -r requirements.txt
```

## For developers

to create tarball with required packages just run

For python2
```
$ make tarball-py2
```
For python3
```
$ make tarball-py3
```
For both python versions
```
$ make tarballs
```

## Changelog

All notable changes to this project will be documented in the file CHANGELOG.md

Please check [this guideline](docs/development.md)

## Links
## References

- [ansible/ansible](https://github.com/ansible/ansible) Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems. http://ansible.com/
- [ansible/ansible-modules-core](https://github.com/ansible/ansible-modules-core) Ansible modules - these modules ship with ansible
Expand Down
17 changes: 5 additions & 12 deletions conf/requirements
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
ansible==2.9.10
PyYAML==5.3.1
paramiko==2.7.1
pyasn1==0.4.8
asn1crypto==1.3.0
bcrypt==3.1.7
cffi==1.14.0
PyNaCl==1.4.0
jinja2==2.11.2
six==1.15.0
markupsafe==1.1.1

ansible-base>=2.10,<2.11
Jinja2
PyYAML
paramiko
markupsafe
2 changes: 0 additions & 2 deletions conf/requirements.py2

This file was deleted.

50 changes: 50 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Development

## Build new package

To create new version of portable-ansible or add additional packages to existing distribution there is needed to create `builder` container.

```sh
./manage.sh builder start
./manage.sh builder prepare
./manage.sh builder run
./manage.sh builder stop
```
Note: the list of included packages are listed in the file `conf/requirements`

The result file with portable-ansible build will be available in `builds/` directory.
```sh
ls builds/

portable-ansible-<version>-py3.tar.bz2
```

## Testing

For portable-ansible testing there are needed to create two docker images:
- ansible-client: the container will contain latest ansible build
- ansible-server: this container will be used for connecting from client via ssh keys or username/password

### Preparation Steps

```sh
./manage.sh server start
./manage.sh client start
```

### Running tests
```sh
./manage.sh client local_tests
./manage.sh client remote_tests
```

### Release resources

```sh
./manage.sh server stop
./manage.sh client stop
```
Check there are no `ansible-*` containers up and running
```sh
./manage.sh container list
```
2 changes: 2 additions & 0 deletions etc/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
172.17.0.2 ansible-server
172.17.0.3 ansible-client
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 7a2c8be

Please sign in to comment.