Skip to content

Commit

Permalink
new file and command component usage across markdown files
Browse files Browse the repository at this point in the history
Ticket: ENT-10940
Changelog: None
Signed-off-by: Mikita Pilinka <[email protected]>
  • Loading branch information
mineralsfree committed Jan 4, 2024
1 parent c74a0c4 commit f1df951
Show file tree
Hide file tree
Showing 14 changed files with 130 additions and 102 deletions.
19 changes: 10 additions & 9 deletions getting-started/developing-modules.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ https://github.com/cfengine/promise-type-template

We can add it to our project with the full URL:

```
```command
cfbs add https://github.com/cfengine/promise-type-template
```

From that repo, we have now added a new promise type, it is called `git_example` to avoid confusion with the "real" git promise type used earlier in the tutorial.
Then, we should edit our policy example, `my_policy.cf` to use this module:

```cfengine3
[file=my_policy.cf]
bundle agent hello_world
{
meta:
Expand All @@ -48,19 +49,19 @@ bundle agent hello_world

That's it, you can now build and deploy:

```
```command
cfbs build && cf-remote deploy
```

And to test it, we can delete the folder and run the agent again:

```
```command
cf-remote sudo -H hub "rm -rf /tmp/hugo && cf-agent -KI | grep hugo"
```

The output printed from that remote machine shows that `cf-agent` cloned the repository again, after we deleted it:

```
```output
[email protected]: 'rm -rf /tmp/hugo && cf-agent -KI | grep hugo' -> ' info: Cloning 'https://github.com/gohugoio/hugo.git' -> '/tmp/hugo'...'
[email protected]: ' info: Successfully cloned 'https://github.com/gohugoio/hugo.git' -> '/tmp/hugo''
```
Expand All @@ -83,21 +84,21 @@ Start by editing `cfbs.json`, at least changing the `repo` and `by` URLs.

To test your changes, make sure they are pushed to GitHub, and re-add your module, for example:

```
```command
cfbs remove promise-type-git-example && cfbs add https://github.com/cfengine/promise-type-template
```

**Tip:** Replace the URL with your own repository URL when you've create one using the template.

Then, build and deploy the project again:

```
```command
cfbs build && cf-remote deploy
```

And just like before, you can run manual agent runs to test:

```
```command
cf-remote sudo -H hub "rm -rf /tmp/hugo && cf-agent -KI"
```

Expand All @@ -106,15 +107,15 @@ cf-remote sudo -H hub "rm -rf /tmp/hugo && cf-agent -KI"
As you've changed the high level things, like file name, promise type name, URLs, etc. and deployed that, the only thing you need to edit is the contents of the python file.
So, to test your changes to the python file, a full build is not really necessary, you can just copy over that one file:

```
```command
cf-remote scp -H hub git_example.py /var/cfengine/masterfiles/modules/promises/git_example.py
```

(Assuming you have the `git_example.py` file in the current directory).

And then you can test it:

```
```command
cf-remote sudo -H hub "cf-agent -KIf update.cf && cf-agent -KI"
```

Expand Down
16 changes: 11 additions & 5 deletions getting-started/installation/general-installation.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ Run the bootstrap command, **first** on the policy server:
1. Find the IP address of your Policy Server:


$ ifconfig
```command
ifconfig
```


2. Run the bootstrap command:


$ sudo /var/cfengine/bin/cf-agent --bootstrap <IP address of policy server>
```command
sudo /var/cfengine/bin/cf-agent --bootstrap <IP address of policy server>
```


The bootstrap command must then be run on any client attaching itself to this server, using the ip address of the policy server (i.e. exactly the same as the command run on the policy server itself).
Expand All @@ -78,7 +81,9 @@ together.
The preferred way of setting `def.mailfrom` is from the
[augments file][Augments].

```
```json
[file=def.json]

{
"vars": {
"mailfrom": "[email protected]",
Expand All @@ -102,7 +107,8 @@ ensure they have taken effect.
The preferred way to disable the agent from sending emails is to define
`cfengine_internal_disable_agent_email` from the [augments file][Augments].

```
```json
[file=def.json]
{
"classes": {
"cfengine_internal_disable_agent_email": [ "any" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Download the file-system image package for CoreOS from the [Enterprise Downloads

1. On the CoreOS Host, extract the `fs-img-pkg.tar.gz` archive:

```console
core@coreos ~ $ tar xvf cfengine-nova-{{site.cfengine.branch}}.{{site.cfengine.latest_patch_release}}-{{site.cfengine.latest_package_build}}.x86_64.fs-img.pkg.tar.gz
```command
tar xvf cfengine-nova-{{site.cfengine.branch}}.{{site.cfengine.latest_patch_release}}-{{site.cfengine.latest_package_build}}.x86_64.fs-img.pkg.tar.gz
```

2. On the CoreOS Host, run the install script:

```console
core@coreos ~ $ sudo ./cfengine-nova-{{site.cfengine.branch}}.{{site.cfengine.latest_patch_release}}-{{site.cfengine.latest_package_build}}.x86_64.fs-img.pkg/install.sh
```command
sudo ./cfengine-nova-{{site.cfengine.branch}}.{{site.cfengine.latest_patch_release}}-{{site.cfengine.latest_package_build}}.x86_64.fs-img.pkg/install.sh
```

Note: Install actions logged to `/var/log/CFEngine-Install.log`.
Expand All @@ -33,8 +33,8 @@ Note: Install actions logged to `/var/log/CFEngine-Install.log`.

Run the bootstrap command:

```console
core@coreos ~ $ sudo /var/cfengine/bin/cf-agent --bootstrap <IP address of the Policy Server>
```commmand
sudo /var/cfengine/bin/cf-agent --bootstrap <IP address of the Policy Server>
```

## Next steps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ We ready now ready to install the CFEngine software on both the server and clien
Run the following script on your designated Policy Server (hub), the virtual machine with the
configured firewall from earlier steps:

```console
$ wget https://s3.amazonaws.com/cfengine.packages/quick-install-cfengine-enterprise.sh && sudo bash ./quick-install-cfengine-enterprise.sh hub
```command
wget https://s3.amazonaws.com/cfengine.packages/quick-install-cfengine-enterprise.sh && sudo bash ./quick-install-cfengine-enterprise.sh hub
```

This script installs the latest CFEngine Enterprise Policy Server on your server machine.
Expand Down Expand Up @@ -156,8 +156,8 @@ Upon successful completion, a confirmation message appears: "Bootstrap to '172.3
* Ensure you are logged into the host machine setup earlier.
* Install CFEngine client version using the following:

```console
$ wget https://s3.amazonaws.com/cfengine.packages/quick-install-cfengine-enterprise.sh && sudo bash ./quick-install-cfengine-enterprise.sh agent
```command
wget https://s3.amazonaws.com/cfengine.packages/quick-install-cfengine-enterprise.sh && sudo bash ./quick-install-cfengine-enterprise.sh agent
```

Note: The installation will work on 64-bit and 32-bit client machines (the host requires a 64-bit machine).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Please Note: Internet access is required from the host if you wish to use the qu

Run the following script on your designated Policy Server (hub) 64-bit machine (32-bit is not supported on the Policy Server):

```console
$ wget https://s3.amazonaws.com/cfengine.packages/quick-install-cfengine-enterprise.sh && sudo bash ./quick-install-cfengine-enterprise.sh hub
```command
wget https://s3.amazonaws.com/cfengine.packages/quick-install-cfengine-enterprise.sh && sudo bash ./quick-install-cfengine-enterprise.sh hub
```

This script installs the latest CFEngine Enterprise Policy Server on your machine.
Expand All @@ -52,8 +52,8 @@ The Policy Server must be bootstrapped to itself. Find the IP address of your Po

Run the bootstrap command:

```console
$ sudo /var/cfengine/bin/cf-agent --bootstrap <IP address of policy server>
```command
sudo /var/cfengine/bin/cf-agent --bootstrap <IP address of policy server>
```

**Example: $ sudo /var/cfengine/bin/cf-agent --bootstrap 192.168.1.12**
Expand All @@ -62,8 +62,8 @@ Upon successful completion, a confirmation message appears: "Bootstrap to '192.1

Type the following to check which version of CFEngine your are running:

```console
$ /var/cfengine/bin/cf-promises --version
```command
/var/cfengine/bin/cf-promises --version
```

The Policy Server is installed.
Expand All @@ -74,8 +74,8 @@ Install Enterprise on your designated Host(s) by running the script below. Per t
install Enterprise on 25 Hosts. Note that the Hosts must be
on the same network as the Policy Server that you just installed in Step 2.

```console
$ wget https://s3.amazonaws.com/cfengine.packages/quick-install-cfengine-enterprise.sh && sudo bash ./quick-install-cfengine-enterprise.sh agent
```command
wget https://s3.amazonaws.com/cfengine.packages/quick-install-cfengine-enterprise.sh && sudo bash ./quick-install-cfengine-enterprise.sh agent
```

Note that this installation works on 64- and 32-bit machines.
Expand All @@ -85,8 +85,8 @@ Note that this installation works on 64- and 32-bit machines.
All Hosts must be bootstrapped to the Policy Server in order to establish a connection between the Host and
the Policy Server. Run the same commands that you ran in Step 3.

```console
$ sudo /var/cfengine/bin/cf-agent --bootstrap <IP address of policy server>
```command
sudo /var/cfengine/bin/cf-agent --bootstrap <IP address of policy server>
```

**Example: $ sudo /var/cfengine/bin/cf-agent --bootstrap 192.168.1.12**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ First download the binary onto the host.

Next unpack the archive. For the 64 bit tarball use:

```sh
```command
tar --gunzip --extract --directory / --file ./cfengine-nova-{{site.cfengine.branch}}.{{site.cfengine.latest_patch_release}}-{{site.cfengine.latest_package_build}}.x86_64.pkg.tar.gz
```

Otherwise, for 32 bit tarball, use:

```sh
```command
tar --gunzip --extract --directory / --file ./cfengine-nova-{{site.cfengine.branch}}.{{site.cfengine.latest_patch_release}}-{{site.cfengine.latest_package_build}}.i386.pkg.tar.gz
```

Generate a keypair for the client:

```sh
```command
/var/cfengine/bin/cf-key
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ creates a Vagrant Project directory.
Step 3. Open a terminal and navigate to the Vagrant Project directory (e.g.
`/home/user/CFEngine_Enterprise_vagrant_quickstart-{{site.cfengine.branch}}.{{site.cfengine.latest_patch_release}}-{{site.cfengine.latest_package_build}}`, or `C:\CFEngine_Enterprise_vagrant_quickstart-{{site.cfengine.branch}}.{{site.cfengine.latest_patch_release}}-{{site.cfengine.latest_package_build}}`) and enter the following command:

```console
$ vagrant up
```command
vagrant up
```

Vagrant performs the following processes:
Expand Down Expand Up @@ -112,8 +112,10 @@ status` output. Both the 'root' and 'vagrant' users passwords are set to

**Example:**

```console
$ vagrant ssh hub
```command
vagrant ssh hub
```
```output
Last login: Fri Jun 13 18:58:10 2014 from 10.0.2.2
```

Expand All @@ -130,8 +132,10 @@ for the clients.
Running `vagrant status` from the vagrant project directroy will produce
output like this.

```console
$ vagrant status
```command
vagrant status
```
```output
Current machine states:
hub not created (virtualbox)
Expand All @@ -147,35 +151,41 @@ VM, run `vagrant status NAME`.
To start or resume a halted environment simply run `vagrant up` from within the
vagrant project directory.

```console
$ vagrant up
```command
vagrant up
```

### Stop the environment (halt/suspend/destroy)

To shut down the vms run `vagrant halt`. This will preserve the vms and any
changes made inside.

```console
$ vagrant suspend
```command
vagrant suspend
```
```output
==> hub: Saving VM state and suspending execution...
==> host001: Saving VM state and suspending execution...
```

To suspend the vms run `vagrant suspend`. This will freeze the state of each vm
and allows for latter resuming of the environment.

```console
$ vagrant halt
```command
vagrant halt
```
```output
==> host001: Attempting graceful shutdown of VM...
==> hub: Attempting graceful shutdown of VM...
```

At any time you can run `vagrant destroy` to remove the provisioned vms. This will
delete the vms and any modifications made to the environment will be lost.

```console
$ vagrant destroy
```command
vagrant destroy
```
```output
host001: Are you sure you want to destroy the 'host001' VM? [y/N] y
==> host001: Forcing shutdown of VM...
==> host001: Destroying VM and associated drives...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ hard nofile 4000
Not sure what your open file limits for `cf-serverd` are? Inspect the current
limits with this command:

```
```command
cat /proc/$(pgrep cf-serverd)/limits
```

Expand Down Expand Up @@ -223,14 +223,14 @@ Note: Install actions logged to `/var/logs/cfengine-install.log`.
Run the bootstrap command, **first** on the policy server and then on each
host:

```console
# /var/cfengine/bin/cf-agent --bootstrap <IP address of the Policy Server>
```command
/var/cfengine/bin/cf-agent --bootstrap <IP address of the Policy Server>
```

After bootstrapping the hub run the policy to complete the hub configuration.

```console
# /var/cfengine/bin/cf-agent -Kf update.cf; /var/cfengine/bin/cf-agent -K
```command
/var/cfengine/bin/cf-agent -Kf update.cf; /var/cfengine/bin/cf-agent -K
```

## Licensed installations
Expand All @@ -245,15 +245,15 @@ to CFEngine support to obtain a license.
It's best to pack the public key into an archive so that it does not
get corrupt in transit.

```console
# tar --create --gzip --directory /var/cfengine --file $(hostname)-ppkeys.tar.gz ppkeys/localhost.pub
```command
tar --create --gzip --directory /var/cfengine --file $(hostname)-ppkeys.tar.gz ppkeys/localhost.pub
```

CFEngine will send you a `license.dat` file. Install the obtained
license with `cf-key`.

```console
# cf-key --install-license ./license.dat
```command
cf-key --install-license ./license.dat
```

## Next steps
Expand Down
Loading

0 comments on commit f1df951

Please sign in to comment.