Ansible error when set the default in a replace task - variables

Hi there i have a problem with setting the default in a task. i have a separat file with my VELABX machines. If a machine is not listed then the task should use the default. but it wont work. so, the following task leads into the shown error at the bottom. what am i doing wrong? how can i solve the problem? thanks!
- name: Replace location for VELAB*
replace:
dest: /tmp/velab.txt
regexp: location
replace: "{{ thautest_inventory[inventory_hostname]['location']|
default(default_location) }}"
vars:
default_location: "text99.1"
The error message:
fatal: [velab170]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute u'velab170'\n\nThe error appears to have been in '/development/standalone/ansible/installation/thautest/ve2_thautest_cfg-specific.yml': line 42, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Insert location\n ^ here\n"}
[WARNING]: Could not create retry file '/development/standalone/ansible/installation/ve2_backup_create_thautest-
cfg.retry'. [Errno 13] Permission denied: u'/development/standalone/ansible/installation
/ve2_backup_create_thautest-cfg.retry'

Related

Lynis wont work, 'error: Unknown option 'ssl-certificate-paths-to-ignore' found (with value: /etc/letsencrypt/archive:)

How do I correct/get rid of the following error? It prevents me from executing any lynis commands.
Output of "Sudo lynis show version" or any lynis command:
"Error: Unknown option 'ssl-certificate-paths-to-ignore' found (with value: /etc/letsencrypt/archive:)".
Background: Installed lynis, but couldn't figure out how to use it - got stuck on changing the parameters following a guide. Tried using another guide (https://adamtheautomator.com/lynis/), which included installing lynis again, and got this error
Tried purging and removing lynis, but got this error again after reinstalling, because thought the error had occured when I had first tried to install and configure lynis.
During the purge got:
"Purging configuration files for lynis (3.0.8-100) ...
dpkg: warning: while removing lynis, directory '/etc/lynis' not empty so not removed
Purging configuration files for menu (2.1.47ubuntu4) ...".

Unable to execute the script file using ansible playbook for redislbas & jmeter

I am trying to install redislabs and jmter using ansible playbook, but unable to execute the script using playbook. Please find my playbook and error as well.
ERROR:
fatal: [localhost]: FAILED! => {"changed": true, "msg": "non-zero return code", "rc": 127, "stderr": "/home/ansibleadm/.ansible/tmp/ansible-tmp-1576768466.18-58336526997867/jmeter.sh: line 109: /home/ansibleadm/.ansible/tmp/ansible-tmp-1576768466.18-58336526997867/jmeter: No such file or directory\n", "stderr_lines": ["/home/ansibleadm/.ansible/tmp/ansible-tmp-1576768466.18-58336526997867/jmeter.sh: line 109: /home/ansibleadm/.ansible/tmp/ansible-tmp-1576768466.18-58336526997867/jmeter: No such file or directory"], "stdout": "", "stdout_lines": []}
Note: Below error for jmeter and getting same error for redislabs as well. like No such file or directory
cat jmeter.yaml
hosts: localhost
user: ansibleadm
connection: local
become: yes
become_method: sudo
tasks:
name: creating jmeter directory
file: path=/home/ansibleadm/jmeter state=directory mode=0700 owner=ansibleadm group=ansibleadm
name: downloading jmeter tar file
get_url:
url: http://apache.mirrors.tds.net//jmeter/source/apache-jmeter-5.2.1_src.tgz
dest: /home/ansibleadm/jmeter
name: untar the file
unarchive:
src: "/home/ansibleadm/jmeter/apache-jmeter-5.2.1_src.tgz"
dest: "/home/ansibleadm/jmeter"
name: executing jmeter.sh file
script: "/home/ansibleadm/jmeter/apache-jmeter-5.2.1/bin/jmeter.sh"
2: Please find the redislabs playbook and error:
hosts: redisgroup
user: ansibleadm
become: yes
become_method: sudo
tasks:
name: creating a directory for redislabs
file: path=/home/ansibleadm/remote_redis owner=ansibleadm group=ansibleadm mode=0700 state=directory
name: defining a variable
set_fact:
redis_variable: "/home/ansibleadm/remote_redis"
name: copy the tar file from src to destination.
copy: src=/home/ansibleadm/redislabs-5.4.6-18-rhel7-x86_64.tar dest="{{redis_variable}}/redislabs-5.4.6-18-rhel7-x86_64.tar"
name: untar the file
unarchive:
src: /home/ansibleadm/redislabs-5.4.6-18-rhel7-x86_64.tar
dest: "{{redis_variable}}"
name: execute the install.sh file in remote server
shell: "{{redis_variable}}/install.sh -y"
ERROR:
FAILED! => {"changed": true, "cmd": "/home/ansibleadm/remote_redis/install.sh -y", "delta": "0:00:04.792255", "end": "2019-12-20 02:33:32.430351", "msg": "non-zero return code", "rc": 1, "start": "2019-12-20 02:33:27.638096", "stderr": "/home/ansibleadm/remote_redis/install.sh: line 25: rlec_upgrade_tmpdir/upgrade_checks_error_codes.sh: No such file or directory\ntouch: cannot touch ‘/var/opt/redislabs/log/install.log’: No such file or directory\nchmod: cannot access ‘/var/opt/redislabs/log/install.log’: No such file or directory\n/home/ansibleadm/remote_redis/install.sh: line 64: /var/opt/redislabs/log/install.log: No such file or directory", "stderr_lines": ["/home/ansibleadm/remote_redis/install.sh: line 25: rlec_upgrade_tmpdir/upgrade_checks_error_codes.sh: No such file or directory", "touch: cannot touch ‘/var/opt/redislabs/log/install.log’: No such file or directory", "chmod: cannot access ‘/var/opt/redislabs/log/install.log’: No such file or directory", "/home/ansibleadm/remote_redis/install.sh: line 64: /var/opt/redislabs/log/install.log: No such file or directory"], "stdout": "/home/ansibleadm/remote_redis/install.sh: line 25: rlec_upgrade_tmpdir/upgrade_checks_error_codes.sh: No such file or directory\n2019-12-20 02:33:27 [.] Checking prerequisites\n2019-12-20 02:33:27 [.] Checking hardware requirements...\n2019-12-20 02:33:27 [!] The node’s hardware does not meet the minimum requirements for a production system: \nThe node has 2 cores (minimum is 4) and 7 GB RAM (minimum is 15 GB). \nConsider upgrading your hardware in the case of a production system.\n================================================================================\n\u001b[1m\u001b[91mRedis\u001b[90mLabs\u001b[0m Enterprise Cluster installer.\n================================================================================\n\n2019-12-20 02:33:28 \u001b[92m[.] Checking root access\u001b[0m\n2019-12-20 02:33:28 \u001b[33m[!] Running as user root, sudo is not required.\u001b[0m\n2019-12-20 02:33:28 \u001b[92m[.] Updating paths.sh\u001b[0m\n2019-12-20 02:33:28 \u001b[92m[.] Creating socket directory /var/opt/redislabs/run \u001b[0m\n2019-12-20 02:33:29 \u001b[92m[.] Deleting \u001b[1m\u001b[91mRedis\u001b[90mLabs\u001b[0m debug package if exist\u001b[0m\n2019-12-20 02:33:29 \u001b[92m[.] Installing \u001b[1m\u001b[91mRedis\u001b[90mLabs\u001b[0m packages\u001b[0m\n2019-12-20 02:33:29 \u001b[37m[$] executing: 'yum install -y redislabs-5.4.6-18.rhel7.x86_64.rpm redislabs-utils-5.4.6-18.rhel7.x86_64.rpm'\u001b[0m\n\u001b[90mLoaded plugins: enabled_repos_upload, package_upload, product-id, search-\n : disabled-repos, subscription-manager, tracer_upload\nNo package redislabs-5.4.6-18.rhel7.x86_64.rpm available.\nNo package redislabs-utils-5.4.6-18.rhel7.x86_64.rpm available.\nError: Nothing to do\nUploading Enabled Repositories Report\nLoaded plugins: product-id, subscription-manager\n\u001b[0m2019-12-20 02:33:32 \u001b[91m[x] yum install failed\u001b[0m", "stdout_lines": ["/home/ansibleadm/remote_redis/install.sh: line 25: rlec_upgrade_tmpdir/upgrade_checks_error_codes.sh: No such file or directory", "2019-12-20 02:33:27 [.] Checking prerequisites", "2019-12-20 02:33:27 [.] Checking hardware requirements...", "2019-12-20 02:33:27 [!] The node’s hardware does not meet the minimum requirements for a production system: ", "The node has 2 cores (minimum is 4) and 7 GB RAM (minimum is 15 GB). ", "Consider upgrading your hardware in the case of a production system.",
In the last step change script: to shell:.
The script tasks "uploads" the script to the target host and executes the uploaded one, but it is uploaded into a temporary directory (see the ansible-tmp-XXXXXXX in the error output). The script (jmeter.sh) then tries to find jmeter in that directory but obviously it is not there. By using shell: instead it will just run the script from the proper place.

How can I fix this bug with ScyllaDB?

I'm trying to work through the ScyllaDB tutorial series here: https://www.scylladb.com/2017/11/30/mutant-monitoring-system-day-1/
I've got a Docker container running (on Windows, using Powershell) and have cloned their repo, and run it with Docker Compose:
PS C:\repos\scylla-code-samples\mms> docker-compose up -d
mms_scylla-node3_1 is up-to-date
mms_scylla-node2_1 is up-to-date
Creating mms_scylla-node1_1 ... done
Trying to check its status with the nodetool returns a container restarting error:
PS C:\repos\scylla-code-samples\mms> docker exec -it mms_scylla-node1_1 nodetool status
>>
Error response from daemon: Container c2940e14078fcdbbcf70f60392b05eb3d5c90273a15970c8575aad46cd797a02 is restarting, wait until the container is running
The logs show these unexpected end of file errors:
2019-03-05T09:39:36.882128500Z /start.sh: line 36: syntax error: unexpected end of file
2019-03-05T09:40:38.038237500Z /start.sh: line 4: $'\r': command not found
2019-03-05T09:40:38.038383700Z /start.sh: line 36: syntax error: unexpected end of file
2019-03-05T09:41:38.922861400Z /start.sh: line 4: $'\r': command not found
2019-03-05T09:41:38.923067400Z /start.sh: line 36: syntax error: unexpected end of file
2019-03-05T09:42:39.801821900Z /start.sh: line 4: $'\r': command not found
2019-03-05T09:42:39.802078500Z /start.sh: line 36: syntax error: unexpected end of file
2019-03-05T09:43:40.696641100Z /start.sh: line 4: $'\r': command not found
2019-03-05T09:43:40.696928800Z /start.sh: line 36: syntax error: unexpected end of file
How can I fix this, preferably without writing code?
The \r is indicative of windows-style carriage returns, so maybe it is related to your Windows environment somehow. Advise is to try this on a Linux box, and in parallel open a bug with the scylla-code-samples.git project so that it can be fixed.
On windows, you can try using the Docker Toolbox which uses a Virtual Box based docker host rather than the one that's part of the new "Docker for Windows". This ensure that you are running on Linux without having a Linux box.
Even though it says "Legacy Desktop Solution" It still works well.
https://docs.docker.com/toolbox/toolbox_install_windows/

Apache2 module Filebeat

I'm following this documentation https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-apache2.html in order to connect an apache web server access log file using file beat to elasticsearch, everything was ok until I changed the path of apache2.yml I got the following error :
2018-09-22T14:21:55.791+0100 ERROR instance/beat.go:691 Exiting: 1 error: error
loading config file: invalid config: yaml: line 3: found unknown escape character
Exiting: 1 error: error loading config file: invalid config: yaml: line 3: found unknown escape character
this id apache2.yml configuration file :
- module: apache2
access:
enabled: true
var.paths: ["‪C:\Program Files\filebeat-6.3.2-windows\logs\Apache\Access.log"]
If you are using double quotes in
"‪C:\Program Files\filebeat-6.3.2-windows\logs\Apache\Access.log"
you need to escape the backslash characters
"‪C:\\Program Files\\filebeat-6.3.2-windows\\logs\\Apache\\Access.log"
Use / instead of . \ is used to escape characters.
I had the same problem

Pig Hcatalog error

I am trying to run pig script in local mode on a single node cluster as given below.
hduser#ubuntu:~$ pig -x local -f "/home/hduser/ddsoft/pigscript/FirstUDF.pig"
But I am getting below error.
[main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 101: file
'/home/hduser/ddsoft/hive-0.13.1-bin/hcatalog/share/hcatalog/hcatalog-core-0.13.1.jar'
does not exist.
how do I register the jar file mentioned in the error message. I tried updating the .bashrc, but it didn’t fix the error.