Hot answers tagged

5

No, you can't have multiple gitlab-ci files per repository. You can see more information in the following links : https://gitlab.com/gitlab-org/gitlab-foss/issues/18157 https://gitlab.com/gitlab-org/gitlab-foss/issues/28592 Now, there are some work in progress about this, but it's not available yet. For example, you can see here ( https://gitlab.com/...


4

The issue seems resolved, If I escape the backslash in the regex too: - name: Remove LE webroot definition lineinfile: path: "/etc/path/to/config/{{ inventory_hostname }}.conf" regexp: "^{{ inventory_hostname | replace('.', '\\.') }} = /path/to/a/directory" state: absent


3

Running your config.yml through yamllint, produced the following: 1:1 warning missing document start "---" (document-start) 13:3 error duplication of key "build" in mapping (key-duplicates) 25:19 error syntax error: mapping values are not allowed here When I add colons to the entry on lines 25 and 28: workflows: version: 2 ...


3

I'd suggest that you first put some default values within the playbook (if you explicitly want your variables there, for the purpose of .. reducing interactivity/command line args lets say): - hosts: all vars: user: greatuser passa: greatpassword Second, I'm pretty sure that pass is a reserved word somewhere, although I'm failing to find it in ...


3

As suggested by @030, I have prepared two screenshots that show how to connect the .yml files with the build pipeline. Rename the .yml file in the repository Open the pipeline editor Select the file from the dropdown Select the in step 1 renamed *.yml file and click on save. After the existing .yml is assigned, the pipeline works as before the renaming.


3

Generally, Ansible is very flexible and often there are more "correct" solutions. Start for example with the question "Where do the configuration data come from?", put the default data to the roles and decide which variables should be configured in "group_vars/host_vars", in the roles, and which in the playbooks. Review Variable precedence: Where should I ...


2

There is only one YAML spec. That would lead me to say "There are no YAML dialects". There are certainly differences in implementation, perhaps due to what the article claims as the spec's ambiguity: YAML specification is so ambiguous, It's a matter of opinion, I believe, but there is no doubting that various language-specific parsers of the same data ...


2

According to the yamllint documentation you need to add a special comment to the line -- <string-to-be-excluded> # yamllint disable-line rule:line-length --- #defaults/main firefox_checksum: sha512:49d776cfb5f42c6e5ea1a55a80d9f6bad223080b16baa0d39de63534c25e68340091b4e16be5355d565f81291cb94fb996f03ae7e3e4c7a28021b0a0929daf58 #yamllint disable-line ...


2

This slide share gives an idea how to handle CasC in Bamboo. The presenter advocates to use yaml, but according to him there are also downsides.


2

I have found the answer to my own question after some more investigation. The reason the state was skipping the contents of my if statement was because the hostname of the server was in lower-case (god knows why). Therefore the in-built salt grains.item host which is called upon didn't recognise the server I was specifying.


2

You can have more than if statement per state. The issue is that your conditional doesn't seem actually be checking the hostname, it's just passing everything. Try this: {% if grains['host'] in ['dev-server2', 'test-server2'] %}


2

According to this Azure Q&A it should be possible to change the name of the yaml file by clicking on "Edit in the visual designer".


2

This can be done by judicious use of one of the Ansible callback plugins. Set the relevant configuration in your ansible.cfg file. You have a few options... In order to print nothing to the screen, you can use the null callback: This callback prevents outputing events to screen However, this may be overkill and doesn't do what you want, which is to ...


2

Not in pure Docker Compose. If you have a plain-text templating engine you like (Mustache, Jinja, m4, ...) you can ask it to do this for you. You tagged this as shell-script, and Compose can take the YAML configuration on stdin, so in principle one option is to write a shell script, and then pipe that into docker-compose: #!/bin/sh buildComposeYaml() { ...


2

Assuming that deploy to DEV and QA steps look a lot like your deploy to production-staging environments, put the code that does that work into a yaml template and take advantage of parameters to allow you to pass in differing environment settings for DEV, QA, and Staging-Production. Then in one pipeline create a stage for each environment. The stage ...


2

Surprisingly indeed GitLab works weirdly with the env vars. It evaluates them internally, though it shouldn't in my view. Value set as (in project Settings > CI/CD > Variables): 'aaa$bbb*%' becomes 'aaa*%' (with single quotes left!) Couple of of proof links: https://gitlab.com/gitlab-org/gitlab-ce/issues/45173#note_101659865 https://gitlab.com/gitlab-org/...


1

Using docker-compose version 3.3 extensions and with the long variants for ports & volumes: version: '3.3' services: s1: &s build: . ports: - published: 5001 target: 9000 volumes: - source: ../www1 target: /var/www s2: <<: *s ports: - published: 5002 volumes: - source: ../www2 s3: &...


1

I commited the fix to the Github repo. The problem was that a role was included recursively. I split up the roles a bit to fix it. Also discovered a lot of other issues with repeated task executions (not all of the fixed yet because I'm still learning how to structure my ansible tasks)


1

What you are describing is best achieved by either using two jobs or let task 1 also be an init Container as they run in sequence. Alternatively you could use Argo Workflows. https://github.com/argoproj/argo


1

The keyword hosts is missing. Also colons : are needed after the hostnames. Fix the syntax, for example all: children: control: hosts: moriarty.server.com: toby.server.com: managed: hosts: sherlock.server.com: See How to build your inventory.


1

Apparently delegate_to and lininfile or blockinfile do not work properly together, https://github.com/ansible/ansible/issues/28313. Module blockinfile It seems redundant lines have not been written as you would expect. Eventually, blockinfile without a marker does the job. - name: copy the output to a local file blockinfile: dest: "{{ ...


1

kubernetes is picky and case-sensitive: kind: Pod should do it. Also, spec should not be in metadata: apiVersion: v1 kind: Pod metadata: name: Testing spec: containers: - name: mysql image: mysql imagePullPolicy: Always command: ["echo", "SUCCESS"]


1

This is not answering only the question but also a bit more (I put this here for reference): I found out a decent way to tackle this and some complications coming afterwards... (after hours and hours of fiddling) - e.g. to execute the script in an SSH session: deploy job: variables: # the variables could come from anywhere (e.g. GitLab Settings - ...


1

You simply have an incorrect yaml syntax in your workflows jobs list. From what I could very quickly understand on circleCI's documentation, jobs names are accepted as a shorthand if you don't define any parameters. If you have parameters, the list element is a hashmap with top element being the job name. In your specific case, this should give (note the ...


1

Yes - there are at least two options available for managing files in the manner you describe. The first such way is to manage the entire directory using file.directory: /opt/apiv2: file.directory: - user: root - group: root - dir_mode: 755 - file_mode: 644 - recurse: - user - group - mode The second way can manage a ...


1

Have you checked the documentation for cron-jobs? You can use the run command. $ kubectl run hello --schedule="*/1 * * * *" --restart=OnFailure --image=busybox -- /bin/sh -c "date; echo Hello from the Kubernetes cluster" cronjob "hello" created This way you can loop through your customers in a bash script to deploy your containers. Not knowing the big ...


Only top voted, non community-wiki answers of a minimum length are eligible